Skip to content Skip to sidebar Skip to footer

Ie Not Firing Popstate When Hashchange Happens

I have page that is doing the routing on clientside, using history API & push/popstate. Which works just fine on all the modern browsers. (search engines will be supported by n

Solution 1:

This is a known issue in IE11 and all Internet Explorer browsers before Edge.

See this link https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3740423/. The Microsoft response is the last post in this issue report, and notes the newest version that is working.

All versions of IE will display this behavior, and hacking/monkey-patching the correct behavior back into the event framework is probably the only way to make it work reliably. This means you will likely need IE specific logic if you want to implement it yourself.

Solution 2:

Try using a polyfill for History API for better support https://github.com/browserstate/history.js

Solution 3:

In IE 10 and 11 the popstate event will only be fired for a history item after the state has been set with history.pushState or replaceState, including when it is set to null, and only when traversing between two items that have had state set. Therefore, it is necessary to set the state for a new history item in the hashchange event. Once the state is set, the popstate event will fire when the user navigates through the browser history.

https://developer.mozilla.org/en-US/docs/Web/API/History

Post a Comment for "Ie Not Firing Popstate When Hashchange Happens"