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?
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.