如何将IE11重定向到其他网站

use*_*530 0 html javascript jquery internet-explorer redirect

我有疑问.

我必须将IE用户重定向到其他网站,从IE6到IE9这个代码工作得非常好.

<!--[if IE]><script type="text/javascript">window.location = "google.com";</script><![endif]-->
Run Code Online (Sandbox Code Playgroud)

这段代码对IE 10非常有用

<script type="text/javascript">if (navigator.appName == 'Microsoft Internet Explorer'){self.location = "google.com"}</script>
Run Code Online (Sandbox Code Playgroud)

但是我找不到IE11的任何解决方案 - 在这个浏览器中我的网站没有重定向.

我真的在寻找更多时间这个解决方案,但我找不到任何想法.

也许您知道如何只编写一个脚本来将所有IE浏览器重定向到其他网站?

非常感谢!

Nie*_*sol 6

根据您的意见,浏览器检测不是可行的方法.

而是使用特征检测.在这种情况下:

var test = document.createElement('video');
if( !test.canPlayType) { /* HTML5 video not supported at all */ }
else if( !test.canPlayType("video/whatever")) {
    // replace "whatever" with the correct MIME type
    // if that type is not supported, do something here
}
else { /* you're all good? */ }
Run Code Online (Sandbox Code Playgroud)