vue-router: iOS Safari on iPhone, history mode triggers page refresh

Hello, came across a bug with VueRouter 2.0.1 and iOS Safari on iPhone only.

If I use the history mode of the Router which is supposed to be supported by the browser it fails and triggers a page refresh instead of changing the state.

You can try it with the official example fiddle here: http://jsfiddle.net/yyx990803/xgrjzsup/ Just change the mode to history and test iOS Safari on an iPhone.

The workaround is simple, I use userAgent detection instead of feature detection to check for iPhone and Safari and change the mode back to hash. I have no idea of what is causing the page refresh, it’s not the history API as using a regular window.History.pushState() works in the browser.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 17 (5 by maintainers)

Most upvoted comments

On a related note, I get the same problem when saving the web-app to home page on iOS. Removing history-mode makes it run correctly for the simulator (but not actual iphone), while having history mode on causes it to reload every time url changes.

Same here on iPhone SE (iOS 10.2) and on iPhone 6 (10.1.1), unfortunately I can’t reproduce it. I have another iPhone SE with the same iOS version and it works fine there.

EDIT: Looks like this Problem only exists if you’re using incognito mode.