I have some javascript code which, at one point, sets window.location.hash
to a specific string. This works fine in Firefox 3, but I want to know if I will run into problems with this later, i.e. is this a cross-browser solution (IE6 included)?
Also, I am using ReallySimpleHistory. Will this mess up its internal state?
Thanks
window.location.hash
has been around since JavaScript was introduced in Netscape Navigator 2 back in 1995. It was first supported by Microsoft in Internet Explorer 3 in 1996. I think you can be reasonably certain that every JS-capable browser supports it.
From a quick glance through the source, it looks as if ReallySimpleHistory makes pretty extensive use of this property, so you may well break it. You might want to use its add(newLocation)
method instead (which works by setting window.location.hash
).
Get:
var hash = location.hash.slice(1);
Set:
location.hash = '#' + 'string';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With