views:

215

answers:

4

Or i should render as default(IE8)?

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

My purpose is to make site compatible with IE8 also.

A: 

Yes there are cons. IE7 is bad. You don't want IE8 to pretend being bad, just so you can get away with poor design decision...

Tor Valamo
It's better than IE6.
Sam152
@Sam152: That doesn't make it good.
Adam Kiss
+2  A: 

Well, that depends on whether you need it! If your site is broken in IE8 (e.g. because you use conditional comments or hacks to identify IE that apply to 8 as well) and it's not an option to fix it, use the compatibility mode. Otherwise, don't - if you're lucky, your HTML might render identically in IE8 and the current Gecko / Webkit browsers.

EmulateIE7 is a fix to ensure compatibility without webmasters having to painfully re-build their pages straight away.

It's definitely not a good practice to use if you're building a site from scratch.

Pekka
+1 . Ok, So i should not include this in my workflow. but it can save some time in testing. and as you suggested "if you're building a site from scratch" ok, but even if i use this on some pre-built site , then is there any cons. What will happen when on old site any user will revert rendering back to IE8 using button near address bar. is this code `<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />` just keeping than button in IE 7 mode or it's do something more.
metal-gear-solid
@jitendra if the pre-built site supports only IE7, and is broken in IE8, then this is what the compatibility mode was intended for. The broken markup should still be fixed because one day, IE9 will come.
Pekka
A: 

IE7 compatibility does not work like IE7 despite anything Microsoft says.

Rob
Interesting. Can you elaborate on this?
Pekka
Well, it doesn't work *exactlty* as IE7, rather like IE7 with some bug fixes. It's not even supposed to emulate IE7, just to be able to view pages designed for IE7.
Guffa
@Rob - agreed. There are subtle, but numerous differences. The rendered width/height of an iframe where width/height are specified as 100% is one. IE7==fit to container, IE8==expand to default size ~=300px x 125px (depending on rendering mode)
scunliffe
+2  A: 

[comment to Pekka's answer that won't fit in a comment:]

What will happen when on old site any user will revert rendering back to IE8 using button near address bar.

If you specify IE=EmulateIE7, there will be no ‘compatibility mode’ button present for the user to click. Putting any IE= option in sets that mode as definitive.

So if you want to work on IE8 as IE8 but you don't want the broken-looking button to appear, you say:

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

(Make sure the page works in IE8 mode first!)

You can also say IE=Edge, which will always give you the latest mode (so on IE9, the browser will not pretend to be IE8). You'll have to be confident that your code is all nicely standards-compliant before doing that. You should be OK if the page works in the other browsers (firefox, chrome, opera...).

bobince