-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replaceState needs third argument #2195
Labels
Comments
You can also provide a repository or use codesandbox.io, for example. |
@LinusBorg I've add a demo repository to reproduce this issue. |
Thanks for reporting this. I created a PR, need to check tests and on IE to add a conditional call or not |
posva
added a commit
that referenced
this issue
Aug 10, 2018
Fix #2195 <!-- Please make sure to read the Pull Request Guidelines: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines -->
This was referenced Aug 29, 2019
This was referenced Oct 26, 2019
This was referenced Jan 20, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
3.0.1
Reproduction link
https://github.com/raxxarr/router-demo.git
Steps to reproduce
<base href="/app/">
What is expected?
jump back to /app/p1
What is actually happening?
jump to /app/
This issue is caused by using replaceState without giving a third argument when trying to fix a Firefox scroll issue (https://github.com/vuejs/vue-router/blob/dev/src/util/scroll.js#L9); This works fine on most browsers except for Safari.
According to whatwg spec,if the 3rd argument is not given,browser should set current url into history,but Safari set the base url.
Here is Webkit source code: https://trac.webkit.org/browser/webkit/branches/safari-605.2.8.1-branch/Source/WebCore/page/History.cpp#L157
Here is Blink source code: https://chromium.googlesource.com/chromium/blink/ /master/Source/core/frame/History.cpp#153
As is seen, what Safari do is not what we expect when we omit the 3rd argument.
Although this is not really a vue-router bug, we can add a third argument(current path) to avoid something weird happen.
ps: this bug is confirmed by Webkit https://bugs.webkit.org/show_bug.cgi?id=182678
The text was updated successfully, but these errors were encountered: