Can I detect when a user gets to a page using the back button?

前端 未结 4 825
無奈伤痛
無奈伤痛 2021-01-11 20:37

Edit: What I really need to know is if there is any javascript event that will reliably fire when the user arrives at the page via the back button. I trie

4条回答
  •  日久生厌
    2021-01-11 20:59

    The answer by @tkotitan was probably correct when he wrote it. His answer led me to my solution. It's not foolproof, but it might be "good enough" to help in some situations.

    I improved my script and replaced it with the following. This version is for an intermediate page that now works as intermediate in both directions.

    Go forward';
    }
    elseif($_GET['page']!=2)
    {
        echo 'You cannot stay here.';
        echo '
        
        
    '; } else { echo 'Welcome to page 2'; } ?>

提交回复
热议问题