Prevent back button after logout

前端 未结 9 1846
梦如初夏
梦如初夏 2020-12-05 08:11

I don\'t want the user to go back to secured pages by clicking back button after logging out. In my logout code, I am unsetting the sessions and redirecting to login page.Bu

9条回答
  •  攒了一身酷
    2020-12-05 08:38

    Here's an easy and quick solution.

    To the login form tag add target="_blank" which displays content in a different window. Then after logout simply close that window and the back button problem (Safari browser) is solved.

    Even trying to use the history will not display the page and instead redirect to login page. This is fine for Safari browsers but for others such as Firefox the session_destroy(); takes care of it.

提交回复
热议问题