Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

html - IE Compatibility Mode: 'X-UA-Compatible' tag 'Edge'

I have this in the <head>:

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

It will force the latest rendering mode for IE, but is Compatibility Mode considered the last one?

I mean, for example: using this code with IE8, it will force it to use IE8 or IE8 Compatibility Mode?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

That tag will try to force the browser to use the latest rendering mode the browser supports. It will not trigger Compatibility mode.

Note that the tag has to be the first tag in the head or it will not work. This fact favors using HTTP headers if possible as the order in the HTTP headers does not matter.

If the browser stills ends up in Compatibility mode when you use a header or the meta tag one of these things is likely the cause:

  • you are missing a sane doctype
  • the browser has been set to always use compatibility mode
  • the site is hosted on an "intranet site" and the default setting for intranet sites is set

Changing the browsers Compatibility View settings

Microsoft considers at least 192.168.x.x to be on a "Intranet site". The default for intranet sites in IE8/IE9 is to use compatibility mode. That's a huge issue for many business applications as the programmer CANNOT override this option even with this meta tag. ("Display intranet sites in Compatitiblity View" is not overridable by meta tag or http header - the browser is in complete control of compatibility view in this case)

Compatibility View Settings

Always add this meta tag or an http header?

One more good thing about using this meta tag is that the "compatibilty view" icon is removed from the address bar of the browser. At least your users can then not decide the render mode using that button.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...