Is History API broken on iOS? (Location bar doesn't update on pushState)

后端 未结 5 1018
你的背包
你的背包 2020-12-08 04:29

Filing this under the either the I Can\'t Believe No One Noticed This Before or the I Must Be Missing Something categories:

It appears that if you do a simple

5条回答
  •  我在风中等你
    2020-12-08 05:03

    Works fine for me when using: https://github.com/browserstate/history.js - this also fixes many other cross browser bugs with the HTML5 History API.

    As of v1.7, here are the bugs it solves:

    • History.js solves the following browser bugs:
      • HTML5 Browsers
        • Chrome 8 sometimes does not contain the correct state data when traversing back to the initial state
        • Safari 5, Safari iOS 4 and Firefox 3 and 4 do not fire the onhashchange event when the page is loaded with a hash
        • Safari 5 and Safari iOS 4 do not fire the onpopstate event when the hash has changed unlike the other browsers
        • Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a replaceState call / bug report
        • Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions / bug report
        • Google Chrome 8,9,10 and Firefox 4 prior to the RC will always fire onpopstate once the page has loaded / change recommendation
        • Safari iOS 4.0, 4.1, 4.2 have a working HTML5 History API - although the actual back buttons of the browsers do not work, therefore we treat them as HTML4 browsers
        • None of the HTML5 browsers actually utilise the title argument to the pushState and replaceState calls
      • HTML4 Browsers
        • Old browsers like MSIE 6,7 and Firefox 2 do not have a onhashchange event
        • MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
        • Non-Opera HTML4 browsers sometimes do not apply the hash when the hash is not urlencoded
      • All Browsers
        • State data and titles do not persist once the site is left and then returned (includes page refreshes)
        • State titles are never applied to the document.title

提交回复
热议问题