Question

Wondering if I can use the HTML5 history API's replaceState() method (or something similar) to change the state of a previously visited page (as opposed to the current page)?

Was it helpful?

Solution

After doing more research...

Strictly speaking, you can't use replaceState() to change where back navigation will go to. However, you can listen to the popstate event and navigate accordingly.

Additional documentation:

Mozilla's guide to 'Manipulating the browser history'

Mozilla's window.history documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top