Skip to content

Commit

Permalink
fix: workaround replaceState bug in Safari (#2295)
Browse files Browse the repository at this point in the history
Fix #2195

<!--
Please make sure to read the Pull Request Guidelines:
https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines
-->
  • Loading branch information
posva authored Aug 10, 2018
1 parent 19b1cd6 commit 3c7d8ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const positionStore = Object.create(null)

export function setupScroll () {
// Fix for #1585 for Firefox
window.history.replaceState({ key: getStateKey() }, '')
// Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
window.history.replaceState({ key: getStateKey() }, '', window.location.href.replace(window.location.origin, ''))
window.addEventListener('popstate', e => {
saveScrollPosition()
if (e.state && e.state.key) {
Expand Down

0 comments on commit 3c7d8ab

Please sign in to comment.