Results 1 to 2 of 2

Thread: Need script to check browser version - to redirect to another page!

  1. #1
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Need script to check browser version - to redirect to another page!

    I am looking for a script that I could place in the header of my main .com page that would check the user's browser and if its older than (explorer 6, or Netscape 5) to redirect them to a HTML page, example update.htm

    Any help would be appreciated

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <script type="text/javascript">
    ;(function(){
    var num = /MSIE/.test(navigator.userAgent)?
    navigator.userAgent.replace(/^.*MSIE (\d+).*$/,'$1') - 1 :
    parseInt(navigator.appVersion);
    if(!isNaN(num) && num < 5)
    window.location = 'update.htm';
    })();
    </script>
    However, not knowing why exactly you want this, it is an open question in my mind as to whether or not a browser earlier than that wouldn't still 'barf' on your page if your page also had other code on it that the browser couldn't handle.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •