How to Redirect all IE users to a new page

后端 未结 8 1179
独厮守ぢ
独厮守ぢ 2020-12-25 14:45

My programmer is on vacation so I need your help! I discovered a page that has a bug for IE users. I want to redirect all IE users to a different page.

How can I d

相关标签:
8条回答
  • 2020-12-25 15:01

    js code:

    <script>if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode)){window.location.href="https://....html";}</script>
    

    You can also use this Boycott-IE:upgrade-your-browser

    0 讨论(0)
  • 2020-12-25 15:05

    A reminder that the [if IE] solution does not apply to IE 10 or greater. This can be very annoying for "features" that have not been fixed by IE 10. I am going to try the php and java solutions and re-comment.

    0 讨论(0)
  • 2020-12-25 15:06

    For Internet Explorer 10 this one works well

    <script type="text/javascript">
       if (navigator.appName == 'Microsoft Internet Explorer')
       {
    
          self.location = "http://www.itmaestro.in"
    
       }
    </script>
    
    0 讨论(0)
  • 2020-12-25 15:13

    Try:

    <!--[if IE]>
    <script type="text/javascript">
    window.location = "http://www.google.com/";
    </script>
    <![endif]-->
    
    0 讨论(0)
  • 2020-12-25 15:15

    Server-side solution using PHP that's guaranteed to work on all browsers:

    <?
    if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
            header("Location: indexIE.html");
    else
            header("Location: indexNonIE.html");
    exit;
    ?>
    
    0 讨论(0)
  • 2020-12-25 15:16

    I put this in header and it works for all IE versions:

    <!-- For IE <= 9 -->
    <!--[if IE]>
    <script type="text/javascript">
        window.location = "https://google.com";
    </script>
    <![endif]-->
    
    <!-- For IE > 9 -->
    <script type="text/javascript">
        if (window.navigator.msPointerEnabled) {
            window.location = "https://google.com";
        }
    </script>
    
    0 讨论(0)
提交回复
热议问题