【问题标题】:Redirect IE8 users to another page将 IE8 用户重定向到另一个页面
【发布时间】:2023-03-29 22:56:01
【问题描述】:

我正在使用 Wordpress 实现一个网站,但 Internet Explorer 8 不支持我的网站。

我可以使用任何代码来将任何 IE8 用户重定向到另一个页面吗?

【问题讨论】:

    标签: php javascript wordpress internet-explorer-8 conditional-comments


    【解决方案1】:

    是的,在 PHP 中,您可以使用 $_SERVER['HTTP_USER_AGENT'] 来检测浏览器并进行相应的重定向。 在 javascript 中,你可以 navigator.userAgent 应用同样的东西。

    【讨论】:

      【解决方案2】:

      我知道你指定了 PHP,但这里有一个 HTML/JS 解决方案:

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

      取自this answer

      如果您只想重定向 IE 8 用户,请将&lt;!--[if IE]&gt; 更改为&lt;!--[if IE 8]&gt;

      【讨论】:

      • 访问被拒绝。 (IE8)
      猜你喜欢
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多