Does window.location.hash contain the encoded or decoded representation of the url part?
When I open the same url (http://localhost/something/#%C3%BC where %C3%BCtranslates to ü) in Firefox 3.5 and Internet Explorer 8, I get different values for document.location.hash:
- IE8:
#%C3%BC - FF3.5:
#ü
Is there a way to get one variant in both browsers?
Unfortunately, this is a bug in Firefox as it decodes
location.hashan extra time when it is accessed. For example, try this in Firefox:The only cross-browser solution is to just use
(location.href.split("#")[1] || "")instead for getting the hash. Setting the hash usinglocation.hashseems to work correctly for all browsers that supportlocation.hashthough.