PDA

View Full Version : History.js getHash() Issue



thomasf4
5 Mar 2012, 1:04 AM
As mentioned in another thread (http://www.sencha.com/forum/showthread.php?137417-Issue-with-Ext.History&) there was a change in History.js:

In 3.3.1 it was:

function getHash() {
var href = location.href, i = href.indexOf("#");
return i >= 0 ? href.substr(i + 1) : null;
}

which in 3.4.0 was changed to:

function getHash() {
var href = location.href, i = href.indexOf("#"),
hash = i >= 0 ? href.substr(i + 1) : null;

if (Ext.isGecko) {
hash = decodeURIComponent(hash);
}
return hash;
}

I'm having a bunch of problems parsing the hash in my URL in Firefox because of the above change. Since it's decoded here I cannot reliably split the hash using '&' later on (as I can in other browsers). My parameters may contain the character '&', which should be encoded at the time of the split.

What was the reason for the change? Any suggestions how I could work around my problem? Are there any known major differences of the "de/encodeURIComponent" method in different browsers?

Thanks!

mitchellsimoens
5 Mar 2012, 9:01 AM
If your values may have '&' in them then you may want to override the getHash method.

arthurakay
22 Aug 2012, 6:45 AM
For community reference, this was in fact a bug. It has been logged as EXTJSIII-84