4

I am a developer on a web app that only works in IE11 if it is added to compatibility view(defaulting the document mode to 5). The problem is that there is a page within the web app that needs CSS :before which does not work correctly if the document mode is below 8. I've tried adding

<!DOCTYPE html> 

and

<meta http-equiv="x-ua-compatible" content="IE=8" >

But the page seems to be defaulting that page to document mode 7. I'm not too familiar with how IE works but is there any way around this?

Timeflies
  • 125
  • 3
  • 14
  • 3
    http://stackoverflow.com/questions/13284083/ie10-renders-in-ie7-mode-how-to-force-standards-mode – Teemu Oct 29 '15 at 19:58
  • There's also a [javascript library](http://stackoverflow.com/q/4181884/2679750) for this – Mark C. Oct 29 '15 at 20:00

2 Answers2

4

If you're trying to avoid Compatibility mode, you need to specify it as follows:

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

The "Edge" mode tells IE to use the best available mode; thus IE11 should use IE11 mode.

If you're still getting stuck in the wrong mode, there are a few other things to check:

  1. Make sure your HTML code is valid and starts with <!DOCTYPE html>. Invalid HTML or a missing doctype is likely to trigger IE to fall back into IE5 mode (also known as Quirks mode). This will clearly break most of the code for pretty much any modern site.

  2. Check your browser and network settings; IE can be configured to override the compatibility settings and always put certain sites into compatibility mode. Typically this is for sites on the local network.

Spudley
  • 166,037
  • 39
  • 233
  • 307
  • Appreciate the response but this is not a modern site. This is a legacy site that I still have to support. Basically I need one single page to run above IE5 mod but the rest not to. Not sure if that's possible or not. – Timeflies Oct 29 '15 at 23:13
  • Okay, that wasn't at all clear from the question. Yes, that's fine -- each page can have it's own mode. For IE5 mode (gosh, really??!), you just leave out the doctype and let IE fall into quirks mode. Note, however, that quirks mode will break the rest of your layout, so you won't get consistent site design between pages. Also, yes you can have different pages with different modes, but you can't combine them using iframes: iframes will always use the mode of the parent window. – Spudley Oct 30 '15 at 06:58
  • I know it's unfortunate. Running into an issue now where all pages are loading with doc type as Edge. Might be a cache issue.. I doubt it will be possible to achieve this. – Timeflies Oct 30 '15 at 13:59
1

You can use the emulate option:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
KittMedia
  • 7,368
  • 13
  • 34
  • 38