【发布时间】:2012-09-27 23:10:45
【问题描述】:
我想知道如何检测 IE 6、IE 7 和 IE8 并判断它们是否显示不同的页面而不是索引。
像 update.html 这样的就可以了。
我见过这些 IF IE6 之类的东西,但仅适用于 CSS,而不适用于索引页面。
提前致谢。
【问题讨论】:
标签: javascript jquery html internet-explorer browser-detection
我想知道如何检测 IE 6、IE 7 和 IE8 并判断它们是否显示不同的页面而不是索引。
像 update.html 这样的就可以了。
我见过这些 IF IE6 之类的东西,但仅适用于 CSS,而不适用于索引页面。
提前致谢。
【问题讨论】:
标签: javascript jquery html internet-explorer browser-detection
有很多资源描述了如何检测浏览器。 Here's the most obvious.
【讨论】:
试试这个 HTML 代码:
<html>
<body>
<!--[if IE]>
<script language="javascript">
document.location = "http://www.google.com/";
</script>
<![endif]-->
redirects to google if IE
</body>
</html>
【讨论】:
在这个页面上有一个很好的脚本可以检测 IE 及其版本。
【讨论】:
您可以通过 jQuery 轻松检测浏览器:
jQuery.browser
jQuery.browser.version
看here
然后检查浏览器名称或版本如上,如果为真则将页面重定向到您喜欢的网址:
window.location.replace("http://your/address/update.html");
【讨论】:
尝试$.browser 以轻松检测浏览器。
【讨论】: