Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
This event fires on window whenever the URL fragment (the part after #) changes:
window.onhashchange = event => {
console.log(location.hash)
}
or
window.addEventListener('hashchange', event => {
console.log(location.hash)
})