1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Rep Power

    Detect and Redirect Internet Explorer 9 ?

    POSTEDetect and Redirect Internet Explorer 9 ?

    Sorry fellas, I am a complete noob
    I am trying to detect if a users browser is Internet Explore Version 9
    the subsequently redirect that browser to a new page that is IE 9 specific in my directory. My code does NOT seem to be working.
    Could any of you kind folks take a look and see the mistake?

    <script language="JavaScript" type="text/JavaScript">
    if(navigator.appName == "Microsoft Internet Explorer"&& navigator.appVersion >=8)
    window.location = "SeansWebsite_2012_IE9.html"
    <!-- the page that i am starting on is "SeansWebsite_2012.html"-->
  2. #2
  3. Standing 3 feet to the left.
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2006
    Rep Power
    Please use [code] tags when posting code. Thank you!

    You can use Browser Sniffing to determine if it's IE9 by checking if window.msPerformance exists. Here's another way that also looks for Document Mode set to "IE9 standards".

    Unless you're trying to show off something IE9 specific or display something using HTML5, I'd pause and consider why you need to detect. A site designed for the general public should be made to degrade gracefully, regardless of browser or version.

    Comments on this post

    • Kravvitz agrees
    I'd rather teach you to fish than give you a fish. I reserve the right to also slap you with the fish.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Atlanta, GA
    Rep Power
    Warning: The following is never the appropriate way to deal with browser differences. Instead of trying to sniff the users browser to determine which document has the appropriate markup, code according to standards, use a standards doctype, and make good use of progressive-enhancement.

    That being said, there are still various valid reasons for wishing to know which browser your user is currently using, and as such the following is how I would accomplish this for IE9 users.

    Personally, I would encourage you to avoid browser sniffing as it's a very unreliable practice. Instead, use what native features the browser affords to you. In the case of Internet Explorer 9, you could use Conditional Comments:

    <!--[if IE 9]>
        <script type="text/javascript">
            alert("You appear to be using IE9");
    Please note that Conditional Comments won't work after IE9 as IE10 dropped support for many of the non-standard features of the browser.

    More on Conditional Comments here: msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

IMN logo majestic logo threadwatch logo seochat tools logo