如何检测脚本,如果检测到老ie,并重定向到另一个页面? [英] How to make detection script , if detect old ie and redirect to another page?

查看:74
本文介绍了如何检测脚本,如果检测到老ie,并重定向到另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使检测脚本,如果检测到旧的ie,并重定向到另一个页面?

最可靠的方法可能是使用条件注释。我建议围绕元重定向包装它们。其他浏览器只会看到HTML注释并忽略它。例如,这会将IE6重定向到example.com:

 < html> 
< head>
<! - [if lte IE 6]>
< meta http-equiv =refreshcontent =0; url = http://example.com//>
<![endif] - >
< / head>
< body> ...< / body>
< / html>


How to make detection script , if detect old ie and redirect to another page?

解决方案

The most reliable way is probably to use Conditional Comments. I suggest wrapping them around a meta redirect. Other browsers will just see a HTML comment and ignore it. Example, this will redirect IE6 and lower to example.com:

<html>
    <head>
        <!--[if lte IE 6]>
            <meta http-equiv="refresh" content="0;url=http://example.com/" />
        <![endif]-->
     </head>
     <body>...</body>
</html>

这篇关于如何检测脚本,如果检测到老ie,并重定向到另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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