javascript - location.replace to remove history of current page without redirecting? -
i had posted question regarding problem here.
when click on submit button or link, not want history of page user clicked button or link recorded in browser.
i received suggestion use history.pushstate()
. not familiar function , urgently need solution work.
i still not sure do. can suggest me whether can use solve problem.
<input type="submit" onclick="location.replace(this.href); return false;"/> <a href="foo.jsp" onclick="location.replace(this.href); return false;">continue</a>
example : have page bar.html
has link <a href="foo.html">foo</a>
. when user clicks on link, should redirected foo.html
, browser history of bar.html
should not recorded user cannot use button on page.
edit: how can force browser not store page in cache, next time user visits, browser requests server page.
here working example:
file: a.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>a</title> </head> <body> <h1>a</h1> <a href="b.html">b</a> </body> </html>
file: b.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>b</title> <script> window.location.replace('c.html'); </script> </head> <body> <h1>b</h1> <a href="c.html">c</a> </body> </html>
file: c.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>b</title> </head> <body> <h1>c</h1> </body> </html>
Comments
Post a Comment