How to Redirect Pages on Firefox

Some webmasters prefer to redirect users to Web pages optimized for certain browsers. You use the JavaScript language to redirect a Firefox browser to a specific page on your website. You must specify a Web page to which you want to redirect. The Web page can be an internal page in your domain or a page on another website.

Instructions

    • 1

      Right-click the HTML page you want to edit. Click "Open With" in the popup menu, then double-click the editor you use to create and edit your Web pages.

    • 2

      Type the following JavaScript tags anywhere in the body of the file:

      <script type="text/javascript"> </script>

      All JavaScript code must be inserted within these two script tags.

    • 3

      Type the following code to detect the browser type:

      var browser = navigator.userAgent;

      If the user opening your Web page is using Firefox, the "browser" variable contains the term "Firefox," so you can redirect according to browser.

    • 4

      Type the following code to redirect the user:

      if (browser == 'Firefox')

      {

      window.location = "newpage.html"

      }

      Replace "newpage.html" with the location where you want to redirect the Firefox user.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured