So let’s say you have a URL like this: http://yoursite.com/#stackoverflow
If I type a new hash into the address bar, it tries to find that ID on the page. Is there amy way (possibly with javascript?) to detect that browser activity and then force the page to reload at that URL?
Thanks!
You need to bind to the
hashchangeevent:Careful though: some older browsers do not support this event (see this), so you’ll need a polyfill for those.
Here’s an example plus a polling technique for older browsers: