IE ignoring conditional comment when I use server

2019-07-17 22:20发布

问题:

I have a web page with the following code in it:

<!--[if IE 8]>
Welcome to IE 8
<![endif]-->

I am logged onto the server, and if I hit the page in IE 8 via the URL http://localhost/login I see the message. However, if I use the URL http://myserver/login (where myserver is the Windows name of the server I am logged into), the page displays and functions normally, except that the message is not displayed.

If I do a View Source, I see the code as I expect it -- the comment displays in the source. (OK, I'm really trying to load a conditional style sheet and it is not being loaded when I use the server name, but this simple example shows the same result).

Any ideas how to exit this new trip to IE bizarro-land?

回答1:

In Page Settings, do you have 'Display intranet sites in Compatibility View' checked? It's all explained in this blog post.