Until all browsers support the onhashchange event what is the best workaround for this?
Is there something for this in jQuery? or as a plug-in?
Not sure if this is what you're looking for or not but worth a try:
http://plugins.jquery.com/project/ba-jquery-hashchange-plugin
Yes there is.
Check out this jQuery plugin: http://benalman.com/projects/jquery-hashchange-plugin/
var lastHash = "";
window.onload=function()
{
hashChangeEventListener = setInterval("hashChangeEventHandler()", 50);
}
function hashChangeEventHandler()
{
var newHash = location.hash.split('#')[1];
if(newHash != lastHash)
{
lastHash = newHash;
//Do stuff!
}
}
Works fine for me across all tested (damn near all) platforms.
http://benalman.com/projects/jquery-bbq-plugin/
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