I'm using the html5-history api and I do this to change the url:
history.replaceState({url: "/hello/stack/", null, "/hello/stack/");
history.replaceState({url: "/overflow/", null, "/overflow/");
Well, then the final result would be:
http://myweb.com/hello/overflow/
Then If I press the previous pave of my browser it redirects me to http://myweb.com/
, and not the previous history url pushed: http://myweb.com/hello/
.
There is a way to call history.go(-1)
when back button of the browser is pressed or something similar to solve this?
Any help, tip or advice would be appreciated, and if you need more info, let me know and I'll edit the post.
replaceState
replaces the current state, in other words, it does not add a new state. If you wish to add more items to the history, use pushState
instead.