preventing use of back button on web pgs

Discussion in 'Technology' started by WhoIsJohnBenson, Mar 11, 2004.

Users Viewing Thread (Users: 0, Guests: 0)

  1. WhoIsJohnBenson

    WhoIsJohnBenson Registered User

    Joined:
    Jun 14, 2003
    Messages:
    984
    Likes Received:
    0
    Location:
    kennels
    preventing use of back button on web pgs

    A real techy geeks question!

    I know that you can disable the back button with use of javascript etc. But what I want to do is ensure that the "Page expired" error comes up if someone presses the back button. Anyone know how to do this?

    Ta :)
  2. 1615634792921.png
  3. moss

    moss Registered User

    Joined:
    Feb 1, 2004
    Messages:
    227
    Likes Received:
    0
    Location:
    South Shields
    I dont think its totally possible to disable the back button.

    You could force the previous page to go forward again..

    Code:
    <script language="JavaScript"><!--
    javascript:window.history.forward(1);
    //--></script>
    
    or I found this method, which replaces the location of the page...but wont work with all browsers.

    Code:
    <script language="JavaScript"><!--
    if (document.images)
        location.replace('http://www.somewhere.com/apage.html');
    else
        location.href = 'apage.html';
    //--></script>
    
    
  4. WhoIsJohnBenson

    WhoIsJohnBenson Registered User

    Joined:
    Jun 14, 2003
    Messages:
    984
    Likes Received:
    0
    Location:
    kennels

    This one looks pretty promising. It could sort the problem cheers :)

Share This Page