开发者

Fallback functions for history.pushState() and window.onpopstate in HTML5

开发者 https://www.devze.com 2023-03-12 08:48 出处:网络
How do I add fallback functions for history.pushState() and window.onpopstate ? I need an if..else kind of logic. If the browser supports proceed, else I need an alternative logic. Even in some modern

How do I add fallback functions for history.pushState() and window.onpopstate ? I need an if..else kind of logic. If the browser supports proceed, else I need an alternative logic. Even in some modern browsers it is not supported eg. in iPad. If not pushState, I need way to catch the back button click of the browser in JS without any having infinite loop开发者_StackOverflow.


history.js might help you. It emulates html5 history functionality on older browsers.

https://github.com/browserstate/history.js

If you don't wan't to use history.js you can probably use url hashes and the hashchange event to catch the back button clicks.

0

精彩评论

暂无评论...
验证码 换一张
取 消