Created
August 2, 2022 18:45
-
-
Save ilhamgusti/6f443f40880ca0a5c6f5d3aac5859ec3 to your computer and use it in GitHub Desktop.
subscribing hash change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ("onhashchange" in window) { | |
window.onhashchange = function () { | |
alert(window.location.hash); | |
} | |
} | |
else { | |
var prevHash = window.location.hash; | |
window.setInterval(function () { | |
if (window.location.hash != prevHash) { | |
prevHash = window.location.hash; | |
alert(window.location.hash); | |
} | |
}, 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment