[IE7 Beta2] Check browser with JavaScript

Discussion in 'Internet Explorer' started by Nono's, Feb 2, 2006.

  1. Nono's

    Nono's Guest

    Hi,

    For some compatibility reasons, I check the browser version with this script:

    <script type="text/javascript">
    //Detect IE
    if (navigator.appVersion.indexOf("MSIE") != -1) {
    window.location.replace("<new_location>")
    }
    </script>

    With IE7 the default security policy for Javascript don't execute this part
    of code and so... my page is not redirected!

    How can I make sure that this page is well redirected?
    Is there another solutions without JavaScript?

    Many thanks

    Nono's
     
    Nono's, Feb 2, 2006
    #1
    1. Advertisements

  2. Nono's,

    Check to see what IE7 is returning. Try this:

    var myBrowser = navigator.appName;
    alert(myBrowser);

    or

    var myBrowser = navigator.appVersion;
    alert(myBrowser);

    And see what it is returning.
     
    Traxion Design, Feb 17, 2006
    #2
    1. Advertisements

  3. The default security policy for JScript didn't change for IE7. What makes
    you think that this code isn't being executed?
     
    Eric Lawrence [MSFT], Feb 17, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.