I'm using history.pushState
to create a 'fake' results page after the user submits a form. However, when I navigate back, the visible page stays the same. What is an easy way to get the original page - unmodified by javascript, but with the form filled out - after pressing back?
You need to watch the current address for changes and react to it yourself.
See this example: https://developer.mozilla.org/en/DOM/window.onpopstate
Also have a look at the documentation:
https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history/
You have to handle the onpopstate
event and reload the previous page manually:
window.onpopstate = function() {
location.reload();
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.