Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

Does the XMLHttpRequest automatically decoded my encoded url?

  • 3 Antworten
  • 1 hat dieses Problem
  • 42 Aufrufe
  • Letzte Antwort von Shadow110

more options

So, today I made a request by using following code:

``` var oReq = new XMLHttpRequest(), url = '/blablabla/' + encodeURIComponent(btoa('%'));

oReq.open('POST', url);

oReq.send(); ```

Notice the value of variable `url` == '/blablabla/JQ%3D%3D'.

However, the URL which Firefox actually requesting is '/blablabla/JQ==' (Actually unescaped. I conformed it by watching my dev server panic).

I did the same test with Chrome, it does the right thing and queried the right URL (Which should be '/blablabla/JQ%3D%3D').

I want to know it's me or the Firefox caused this problem.

Thank you.

So, today I made a request by using following code: ``` var oReq = new XMLHttpRequest(), url = '/blablabla/' + encodeURIComponent(btoa('%')); oReq.open('POST', url); oReq.send(); ``` Notice the value of variable `url` == '/blablabla/JQ%3D%3D'. However, the URL which Firefox actually requesting is '/blablabla/JQ==' (Actually unescaped. I conformed it by watching my dev server panic). I did the same test with Chrome, it does the right thing and queried the right URL (Which should be '/blablabla/JQ%3D%3D'). I want to know it's me or the Firefox caused this problem. Thank you.

Ausgewählte Lösung

Again I think you are asking in the wrong place. That is coding and this is General Support.

They do the coding here https://developer.mozilla.org they would know more than we do. I think this would just sit as not answered for a long time. Or if not there then sites that deal with that sort of coding. Like I do basic HTML5 Responsive and backwards and that's all I know and to put read made scripts in to my code. So ya, think in the wrong place.

Diese Antwort im Kontext lesen 👍 1

Alle Antworten (3)

more options

I think possibly you should get a account on this site maybe...as this goes farther than most of help her do. Any way a place to start: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data

Please let us know if this solved your issue or if need further assistance.

more options

Thank you for respond.

I got around of the problem so I don't have to deal with it right now (I passed the data though POST body rather than query/URL so...)

To the topic, I don't think that document is related as the problem I had was the invalid URL not data.

So, simply put, I just want to know why my URL turned unescaped (Raw) during request even after I manually encodeURIComponent'ed it.

Geändert am von nickrio

more options

Ausgewählte Lösung

Again I think you are asking in the wrong place. That is coding and this is General Support.

They do the coding here https://developer.mozilla.org they would know more than we do. I think this would just sit as not answered for a long time. Or if not there then sites that deal with that sort of coding. Like I do basic HTML5 Responsive and backwards and that's all I know and to put read made scripts in to my code. So ya, think in the wrong place.