How to Disable the Back Button in the Internet Explorer Browser

How to Disable the Back Button in the Internet Explorer Browser thumbnail
Prevent users from going back while filling in a webpage form.

Web users can normally browse web pages in any order they choose. Some web content, however, doesn't suit this browsing style, and webmasters may want to prevent backtracking. You can't completely disable a user's "back" button, according to the coding experts at HTML Goodies and Boutell Consulting, but, using Javascript, you can bounce users forward when they press the "back" button. This effectively disables the "back" button, because the page will reload immediately when a user clicks the "back" button

Things You'll Need

  • HTML or text editor
Show More

Instructions

    • 1

      Open the webpage code in the HTML or text editor. Insert the following code within the page's header, between the </title> and </head> tags:

      <script>

      function backButtonOverrideBody()

      {

      try {

      history.forward();

      }

      catch (e) {

      }

      setTimeout("backButtonOverrideBody()", 500);

      }

      </script>

    • 2

      Replace the <body> tag with the following line:

      <body onLoad="backButtonOverride()">

    • 3

      To circumvent a bug affecting Safari browser users, add the following code between "<script>" and "function backButtonOverrideBody()":

      function backButtonOverride()

      {

      setTimeout("backButtonOverrideBody()", 1);

      }

Tips & Warnings

  • This code won't affect users who disable Javascript.

  • Use this code sparingly. It annoys users who want to leave your page.

Related Searches:

References

  • Photo Credit emty browser window image by .shock from Fotolia.com

Comments

You May Also Like

Related Ads

Featured