How can I expire a page when a user clicks the refresh or back button of a browser?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rommelcalizo
    New Member
    • Oct 2012
    • 1

    How can I expire a page when a user clicks the refresh or back button of a browser?

    How can I expire a page when a user clicks the refresh or back button of a browser using PHP?

    Or how can we prohibit going back to the previous page when a user clicks the back button of a browser using PHP?
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Well you cannot prevent using the back button with PHP, you can with JavaScript but all the user has to do is disable JavaScript to get around it.

    You can use an approach like this to determine if the user has refreshed the page, if they have then use session_destroy () to end their session and redirect them elsewhere.

    Comment

    Working...