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

后端 未结 5 1017
你的背包
你的背包 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:09

    Here's what I found:

    When the pushed location contains a hash symbol, the adressbar will be updated. So this will work:

    window.history.pushState(data, title, 'a/new/url#');
    

    But the window.location object will not be updated so you need to save the pushed url into a variable and use that instead of window.location if you need the pushed location.

    Tested on Safari for Android.

提交回复
热议问题