Opened 13 years ago

Closed 13 years ago

#10319 closed defect (invalid)

dojo.queryToObject() returns different results under IE

Reported by: Massimo Foti Owned by: anonymous
Priority: high Milestone: 1.4
Component: Core Version: 1.4.0b
Keywords: queryToObject Cc:
Blocked By: Blocking:

Description (last modified by James Burke)

The following call returns an object with two entries under FF and Chrome, not in IE 8.


I discovered this issue while using dojo.back() to handle bookmarks and back/forward buttons. So I am serializing plenty of things inside location.hash, ending up with a "querystring containing querystrings"

I managed to solve this issue adding the line below at the very beginning of queryToObject(): str = dojo.isMozilla ? str : decodeURIComponent(str);

I figured out the need of it by looking at the source of dojo.back, where you can find a private function like this:

function getHash(){

var h = window.location.hash; if(h.charAt(0) == "#"){ h = h.substring(1); } return dojo.isMozilla ? h : decodeURIComponent(h);


Looks like IE needs some help, other browsers do just fine, decoding the querystring internally.

Hope it will help

Change History (1)

comment:1 Changed 13 years ago by James Burke

Description: modified (diff)
Resolution: invalid
Status: newclosed

The above example decodes the same across browsers, to a string (the string looks like it has an encodeURIComponent done on the whole thing).

The problem is probably how you get the value you are sending to dojo.formToObject. As the dojo.back code shows, where you read the value from can mean that you need to decodeURIComponent before sending to dojo.objectToQuery. But dojo.objectToQuery by itself does no browser-dependent work. It uses decodeURIComponent under the hood for each piece in the chain, but that performs the same across browsers.

Note: See TracTickets for help on using tickets.