Here is updated version of @johnny.rodgers
Hope helps someone.
// ie9 ve ie7 return true but never fire, lets remove ie less then 10
if(("onhashchange" in window) && navigator.userAgent.toLowerCase().indexOf('msie') == -1){ // event supported?
window.onhashchange = function(){
var url = window.location.hash.substring(1);
alert(url);
}
}
else{ // event not supported:
var storedhash = window.location.hash;
window.setInterval(function(){
if(window.location.hash != storedhash){
storedhash = window.location.hash;
alert(url);
}
}, 100);
}