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 committed 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
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.