Gre*_*egg 16 javascript browser internet-explorer redirect
我的程序员正在度假,所以我需要你的帮助!我发现了一个有IE用户错误的页面.我想将所有IE用户重定向到不同的页面.
我怎样才能做到这一点?我搜索了整个Google和Stackoverflow,但无法找到答案.(我找到了一些脚本,并尝试过它们,但都没有用).
Aym*_*adi 46
尝试:
<!--[if IE]>
<script type="text/javascript">
window.location = "http://www.google.com/";
</script>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
Chr*_*isW 35
或者,非JS解决方案,在您的head部分中添加以下内容:
<!--[if IE]>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com">
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
我把它放在标题中,它适用于所有 IE 版本:
<!-- For IE <= 9 -->
<!--[if IE]>
<script type="text/javascript">
window.location = "https://google.com";
</script>
<![endif]-->
<!-- For IE > 9 -->
<script type="text/javascript">
if (window.navigator.msPointerEnabled) {
window.location = "https://google.com";
}
</script>
Run Code Online (Sandbox Code Playgroud)