function locationHashChanged() {
if (location.hash === "#some-cool-feature") {
someCoolFeature();
}
}
window.addEventListener("hashchange", locationHashChanged);HashChangeEvent / notebook
HashChangeEvent
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.