change hash javascript event code example
Example: javascript detect URL hash change
window.addEventListener("onhashchange", function(){
//url hash # has changed
});
window.addEventListener("onhashchange", function(){
//url hash # has changed
});