Is there a way to keep a page from rendering once a person has logged out but hit the “back” button?

前端 未结 16 2027
感情败类
感情败类 2020-12-01 05:18

I have some website which requires a logon and shows sensitive information.

The person goes to the page, is prompted to log in, then gets to see the information.

16条回答
  •  萌比男神i
    2020-12-01 06:07

    Cache and history are independent and one shouldn't affect each other.

    The only exception made for banks is that combination of HTTPS and Cache-Control: must-revalidate forces refresh when navigating in history.

    In plain HTTP there's no way to do this except by exploiting browser bugs.

    You could hack around it using Javascript that checks document.cookie and redirects when a "killer" cookie is set, but I imagine this could go seriously wrong when browser doesn't set/clear cookies exactly as expected.

提交回复
热议问题