Is there a way for JavaScript to detect when the user changes the URL hash (location.hash) ?
Thanks in advance! :)
Thanks in advance! :)
var curHashVal = window.location.hash; //global reference
window.onload = function(){ //call the function at onLoad time.
setInterval(1000,function(){
if(curHashVal!=window.location.hash){ //changed
//do some work then save the current hash value
curHashVal = window.location.hash;
}
});
}
Comment