Skip to content

Instantly share code, notes, and snippets.

@mishudark
Created May 2, 2011 05:12
Show Gist options
  • Save mishudark/951193 to your computer and use it in GitHub Desktop.
Save mishudark/951193 to your computer and use it in GitHub Desktop.
hash change url event
if ("onhashchange" in window) { // event supported?
window.onhashchange = function () {
hashChanged(window.location.hash);
}
}
else { // event not supported:
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
storedHash = window.location.hash;
hashChanged(storedHash);
}
}, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment