is there a way to redirect Internet Explorer users to another page?

I've seen websites that give instructions on how to do this in html, but not for wordpress installations. Where would you put the code? header.php? What would the code be?

This is also a feature request for a wordpress plugin that would do such a thing... or IS there already such a thing? I haven't found it yet.

  • Han
    • The Crimson Coder

    Hi, try put this code in header

    <script type="text/javascript>
    if(navigator.userAgent.indexOf('MSie')!=-1){location.replace('url.html')}
    </script>

    replace "url.html" with your page url for IE user . Let me know how it goes :slight_smile:

  • derusion
    • Site Builder, Child of Zeus

    I tagged this at the end of my header, and what it does now for IE users is load the header, nothing else, no forwarding to another page, and stops there.:

    <script type="text/javascript>
    if(navigator.userAgent.indexOf('MSie')!=-1){location.replace('http://www.getfirefox.com')}
    </script>

    Should I put it somewhere else in my header? Or did I do something wrong with the URL syntax?

  • Han
    • The Crimson Coder

    Sorry my mistake. Please try this one

    <script type="text/javascript">
    function getInternetExplorerVersion()
    // Returns the version of Internet Explorer or a -1
    // (indicating the use of another browser).
    {
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
    var ua = navigator.userAgent;
    var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
    rv = parseFloat( RegExp.$1 );
    }
    return rv;
    }

    if ( getInternetExplorerVersion() > -1 )
    {
    location.replace('http://www.getfirefox.com');
    }
    </script>

  • derusion
    • Site Builder, Child of Zeus

    THAT made my site say service was unavailable and wouldn't let met update the script. Did that to me in FF and Chrome. Removed those lines, clicked "update" and it updates. It hates your script! lol

    I might be doomed to allow IE users.

    My provider is dreamhost, for what it's worth.

  • derusion
    • Site Builder, Child of Zeus

    Is there a way to privately message you on here? It's the one thing I haven't figured out how to do yet.

    Oh wow, check this out, when I applied your code:

    <script type="text/javascript>
    
    if(navigator.userAgent.indexOf('MSie')!=-1){location.replace('http://www.getfirefox.com)}
    
    </script>

    to my header.php .... very oddly the problems my site's IE users had WENT AWAY! They can now comment and reply to posts in the activity stream where they weren't able to previously.

    Can you think of ANY reason why that might be?

    Thanks for your persistence in helping my crazy antics :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.