如何将所有 IE 用户重定向到新页面

发布于 2024-12-07 13:07:16 字数 147 浏览 1 评论 0原文

我的程序员正在休假,所以我需要你的帮助!我发现一个页面对 IE 用户来说存在错误。我想将所有 IE 用户重定向到不同的页面。

我该怎么做?我搜索了 Google 和 Stackoverflow,但找不到答案。 (我找到了一些脚本,并尝试了它们,但没有一个起作用)。

My programmer is on vacation so I need your help! I discovered a page that has a bug for IE users. I want to redirect all IE users to a different page.

How can I do this? I searched all through Google and Stackoverflow and cannot find an answer. (I found some scripts, and tried them, but none worked).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

清风夜微凉 2024-12-14 13:07:16

尝试:

<!--[if IE]>
<script type="text/javascript">
window.location = "http://www.google.com/";
</script>
<![endif]-->

Try:

<!--[if IE]>
<script type="text/javascript">
window.location = "http://www.google.com/";
</script>
<![endif]-->
赴月观长安 2024-12-14 13:07:16

或者,如果是非 JS 解决方案,请将以下内容放入 head 部分:

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

Or, a non-JS solution, put the following in your head section:

<!--[if IE]>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com">
<![endif]-->
梦忆晨望 2024-12-14 13:07:16

提醒一下,[if IE] 解决方案不适用于 IE 10 或更高版本。对于 IE 10 尚未修复的“功能”来说,这可能非常烦人。我将尝试 php 和 java 解决方案并重新评论。

A reminder that the [if IE] solution does not apply to IE 10 or greater. This can be very annoying for "features" that have not been fixed by IE 10. I am going to try the php and java solutions and re-comment.

高冷爸爸 2024-12-14 13:07:16

我把它放在标题中,它适用于所有 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>

I put this in header and it works for all IE versions:

<!-- 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>
仙女 2024-12-14 13:07:16

对于 Internet Explorer 10,这个效果很好

<script type="text/javascript">
   if (navigator.appName == 'Microsoft Internet Explorer')
   {

      self.location = "http://www.itmaestro.in"

   }
</script>

For Internet Explorer 10 this one works well

<script type="text/javascript">
   if (navigator.appName == 'Microsoft Internet Explorer')
   {

      self.location = "http://www.itmaestro.in"

   }
</script>
離殇 2024-12-14 13:07:16

使用 PHP 的服务器端解决方案保证在所有浏览器上运行:

<?
if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
        header("Location: indexIE.html");
else
        header("Location: indexNonIE.html");
exit;
?>

Server-side solution using PHP that's guaranteed to work on all browsers:

<?
if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
        header("Location: indexIE.html");
else
        header("Location: indexNonIE.html");
exit;
?>
凝望流年 2024-12-14 13:07:16

Internet Explorer 中已删除对条件注释的支持10 个标准

我正在使用这个肮脏的黑客来重定向 IE10+ 用户

<script type="text/javascript">
    var check = true;
</script>
<!--[if lte IE 9]>
<script type="text/javascript">
    var check = false;
</script>
<![endif]-->
<script type="text/javascript">
    if (check) {
        window.location = "page_for_ie10+.html";
    }
</script>

Support for conditional comments has been removed in Internet Explorer 10 standards

I'm use this dirty hack for redirecting IE10+ users

<script type="text/javascript">
    var check = true;
</script>
<!--[if lte IE 9]>
<script type="text/javascript">
    var check = false;
</script>
<![endif]-->
<script type="text/javascript">
    if (check) {
        window.location = "page_for_ie10+.html";
    }
</script>
御守 2024-12-14 13:07:16

Node.js 代码:

<script>if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode)){window.location.href="https://....html";}</script>

您还可以使用此 Boycott-IE:upgrade-your-browser

js code:

<script>if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode)){window.location.href="https://....html";}</script>

You can also use this Boycott-IE:upgrade-your-browser

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文