如何将** IE11 **重定向到新页面? [英] How to redirect **IE11** to a new page?

查看:295
本文介绍了如何将** IE11 **重定向到新页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将当前页面重定向到** IE11 **中的新页面?



这是我到目前为止所获得的,但它没有工作。



How to redirect the current page to a new page in **IE11** ?

This is what I have got so far, but it didn't work.

<!--[if IE]>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.domain.com">
<![endif]-->



------



这个htaccess IE11重定向也不起作用 - >




------

This htaccess IE11 redirect doesnt work either-->

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} IE11 [NC]
RewriteRule ^ http://google.com/ [L,R]





------



这是IE11的用户代理,因此我需要使用这些用户代理重定向访问者 - >



Mozilla / 5.0 (IE 11.0; Windows NT 6.3; Trident / 7.0; .NET4.0E; .NET4.0C; rv:11.0)像Gecko



如何重定向IE11访问者?有什么想法吗?



我的尝试:



我是尝试上面的代码,但IE11访问者继续在同一网站,而不是被重定向到选定的域。 :(



------

This is the user agent of IE11, so I need to redirect visitors with these user agents-->

Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko

How do I redirect IE11 visitors? Any ideas?

What I have tried:

I've tried above code, but IE11 visitors continue to the same site instead of being redirected to the chosen domain. :(

推荐答案

您可能会感到惊讶,但用户代理字符串可能很容易被伪造,因此浏览器可以强制使用任何其他浏览器...

出于这个原因,你不应该根据浏览器检测来区分你的网站,而是基于功能检测...

例如,不要说我只支持Chrome和FF,但是我说我只支持浏览器编译标准,并具有 addEventListener 方法...

此方法将为未来/更新的浏览器打开您的网站,不做任何更改或任何关注,如何浏览器调用或识别自己...

它还使您能够轻松地为不同的浏览器创建不同的解决方案...



您可以使用的简单路径 Modernizr:HTML5 / CSS3的功能检测库 [ ^ ]



You may be surprised but user agent string can be faked easily, so a browser can impost any other browser...
For that reason you should not differentiate your site based on browser detection, but based on feature detection...
For instance do no say I support only Chrome and FF, but say I support only browser compiles to standard and has addEventListener method...
This approach will open your site for future/updated browsers without any change or any concern about, how the browser called or identify itself...
It also enables you to create different solution for different browsers with ease...

For an easy path you may use Modernizr: the feature detection library for HTML5/CSS3[^]

if ( Modernizr.canvas ) { // browser supports canvas
    drawCanvas();
} else {
    // relocate to an error page
    // or
    drawImageFromServer();
}


这篇关于如何将** IE11 **重定向到新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆