【问题标题】:Different behavior when using IP address and computer name to access a website使用 IP 地址和计算机名称访问网站时的不同行为
【发布时间】:2014-10-05 14:47:01
【问题描述】:

我对此感到困惑。我有一个带有下拉菜单的页面。它在 IE 10 和 11(也在其他浏览器中)中表现正确,但在 IE 9 中表现不同。

我有两种方法可以访问我的网站页面:通过计算机IP地址,例如:

http://123.456.789.12/page.html

另一种方法是通过计算机名称,例如:

http://computer-name.com/page.html

当我使用IP地址并将鼠标移到菜单上时,显示正确(下拉菜单):

但是,如果使用计算机名称,我会得到:

我清除了缓存,验证了它们是同一个页面,等等。我不知道为什么在 IE 9 中,它有这样的行为。

有人知道为什么吗?修复?

感谢和问候。

更新:这是我页面的标题

<!DOCTYPE html>
<!--[if lt IE 7]>           <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>               <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>               <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
 <!--<![endif]-->

    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">

    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="/css/normalize.css">

    <link rel="stylesheet" href="/css/reset.css">

    <link rel="stylesheet" href="/lib/font-awesome-4.1.0/css/font-awesome.min.css">

    <link rel="stylesheet" href="/css/styles.css" />

    <script src="/lib/modernizr-2.6.2.min.js"></script>

    <script src="/lib/jquery-1.11.0.min.js"></script>

    <script src="/lib/jquery-ui-1.10.4/js/jquery-ui-1.10.4.js"></script>

    </head>

更新 2:在 SO! 找到解决方案!

Html 5 Reset (html5reset.org) - X-UA-Compatible doesn't work

【问题讨论】:

标签: css internet-explorer internet-explorer-9


【解决方案1】:

这是smart defaults 的一部分,它在站点的两个实例之间切换浏览器/文档模式。

为了保持兼容性,Internet Explorer 附带 基于区域评估的智能默认值。在默认状态下,所有 公共 Internet 上的站点以 Internet Explorer 标准显示 模式(兼容性视图关闭)和所有内网网站显示在 Internet Explorer 7 标准模式(打开兼容性视图)。

将此添加到页面顶部:

&lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;

【讨论】:

  • 我这样做了,但它似乎不起作用。非常感谢你帮助我!
猜你喜欢
  • 1970-01-01
  • 2015-05-16
  • 2013-02-07
  • 1970-01-01
  • 2011-06-14
  • 1970-01-01
  • 2018-09-23
  • 2015-05-11
  • 1970-01-01
相关资源
最近更新 更多