Internet Explorer浏览器版本用户代理的Javascript重定向
Javascript redirect for Internet Explorer browser version user agent?
我发现我的javascript密集型网站在IE9中不可靠(或根本不可靠)。
它的工作,(通常,但并不总是)与标题中的兼容模式元标签,但我只是想建立一个页面,我知道将在IE9中工作良好,然后有通常的页面重定向到它当IE9被检测到。通常的页面在ie7和ie8(以及我尝试过的所有其他浏览器)中都很好。
谁能给我一些javascript,将做到这一点?谢谢你!
这是我平常的页面:
http://ianmartinphotography.com/test-site/test/最简单的方法是使用IE条件语句。
注意: IE10及以上版本已删除对此功能的支持。对于现代浏览器,为了兼容性目的而有条件地显示内容的广泛接受的方式是使用特性检测。Modernizr是一个用于处理特征检测的流行库。
例如:<!--[if IE 9]>
<script type="text/javascript">
window.location = "http://www.ie9version.com";
</script>
<![endif]-->
条件站点示例:
<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>
<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->
<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->
<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>
<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]><![endif]-->
<script LANGUAGE="JavaScript">
<!--
if( navigator.appName.toLowerCase().indexOf("microsoft") > -1 ||
navigator.userAgent.toLowerCase().indexOf("msie") > -1 ) {
window.open("http://www.pobox.com/~qed/windoze.html", "Windoze",
"dependent=no,titlebar=no,scrollbars=yes" );
}
// Paul Hsieh
// qed at pobox dot com
// -->
</script>
来源:http://www.cexx.org/snicker/nomsie.htm
相关文章:
- 通过javascript重定向html传递php变量
- 使用CSS和Javascript重定向-手持设备
- Javascript重定向循环直到成功
- 如何在通过Javascript重定向时保持StatefulSnippet var值
- JavaScript重定向功能
- Chrome:刷新页面后未呈现的背景图像 + JavaScript 重定向
- 从帖子返回后,Javascript重定向不起作用
- 如果 URL 包含使用 JavaScript 重定向的特定端口
- 由 URL 触发的来自 iFrame 的 JavaScript 重定向
- 模拟隐藏表单提交&使用JavaScript重定向以实现安全支付
- 使用Javascript重定向并设置请求属性
- 谷歌分析调用然后用javascript重定向
- 使用Javascript重定向所有推荐链接
- 在没有flash的情况下使用javascript重定向
- 是否可以在node.js中遵循Javascript重定向
- 带有SetTimout的Javascript重定向不工作
- Rgd:Javascript重定向顶部父页
- JavaScript重定向何时真正生效
- 模态中的JavaScript重定向
- 如何阻止javascript重定向页面