开发者

How to change chrome to behave like firefox when using the history.pushState /popstate

开发者 https://www.devze.com 2023-03-04 06:18 出处:网络
I am using ajax to populate parts of my html pages (when the page load or based on user click). When I press the back and forward button using Firefox (4) or Safari (5.0.5) everything is fine. But w

I am using ajax to populate parts of my html pages (when the page load or based on user click).

When I press the back and forward button using Firefox (4) or Safari (5.0.5) everything is fine. But when I press them using chrome I only get the last ajax result (if I press back) instead of the last page in the history.

I tried working with the history.pushState and popstate event but开发者_如何学C The popstate event is fired when the page load and not when I press the back button which is counter intuitive.


Use History.js it normalizes the behavior between browsers and optionally provides a hash fallback for html4 browsers.

0

精彩评论

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