javascript - Expiring a page when back button is clicked -


i have page searches flight. if user has clicked button in browser, should display error message. tried following code: -

   function preventback(){window.history.forward();}      settimeout("preventback()", 0);      window.onunload=function(){null}; 

problem is not redirecting page saying "this document has been expired."

you can not detect if user has clicked "back" button natively. reason

this document has been expired

is send new form again , againt on previous page. great flaw in architecture.

however if still insist on approach, you can use this plugin. redirect error page, when back-click detects. (like window.location = '/path/to/error/page.html')


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -