Skip to content

Use replace when "correcting" hashbangs #4

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

Closed
frolic opened this issue May 23, 2015 · 0 comments
Closed

Use replace when "correcting" hashbangs #4

frolic opened this issue May 23, 2015 · 0 comments

Comments

@frolic
Copy link

frolic commented May 23, 2015

https://github.com/vuejs/vue-router/blob/master/src/index.js#L158

If I have hashbangs enabled and I navigate to a URL like /#/some/path, it gets corrected to /!#/some/path. However, the correction adds an entry to the history, essentially breaking the back button (because going back immediately redirects to the same page again).

It looks like we can take advantage of history.replaceState to overcome this:
http://stackoverflow.com/a/9282379/143455

Alternatively, location.replace may work too (although I'm not sure if the hash change will affect the DOM if the router-view doesn't actually change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant