8

The last year, I've created some html5 (with some php in, but that's not relevant I think) websites and everything went well in Internet Explorer 10, Chrome, Firefox....

But last week, my boss orderd a new pc with Windows 8.1 on it, and ofc. IE 11, and all my websites look ugly. I checked with F12 tools and on the emulation tab, it says Documentmode = 7 (default). If I change it to Edge, everything shows as it should be....but after a refresh it just jumps back to 7.

I always used <!DOCTYPE html> on top of my pages and always worked in the past. But now, IE11 on win8.1 seems to ignore it. The reason why I think it's Windows 8(.1) only is because I have also IE11 installed, but on a Windows7 PC. I double checked and there are no websites added to the list for compabilityview on both PC's

After some searching I found <meta http-equiv="X-UA-Compatible" content="IE=edge" /> and it works!

But I can't find anywhere why it is like this and if there is another solution instead of opening every page of every website I've created and adding the meta-tag...

My first question here, hope I did well :-)

diedie2
  • 366
  • 1
  • 6
  • 17
  • +1 for asking why. I'd like to add that microsoft themselves use on their HTML5 websites. Another great explanation: http://stackoverflow.com/questions/6771258/whats-the-difference-if-meta-http-equiv-x-ua-compatible-content-ie-edge-e – qwertzman Feb 03 '14 at 02:37

2 Answers2

6

Where is the site being served from? Is it on your local network/intranet? I seem to remember that IE defaults to compatibility mode for sites in the "Intranet Zone". So this shouldn't happen to users accessing it from the outside world. See http://msdn.microsoft.com/en-us/library/jj676914%28v=vs.85%29.aspx

You can send X-UA-Compatible as a server header, instead of changing every page of every site. See http://msdn.microsoft.com/en-us/library/jj676913%28v=vs.85%29.aspx

Olly Hodgson
  • 15,076
  • 3
  • 40
  • 60
  • The sites are hosted by [Vibit](http://www.vibit.eu/) I have access to a cPanel for every site, but not sure if I can set those server header there... – diedie2 Dec 12 '13 at 15:13
  • 2
    Assuming you're on an Apache server, you should be able to set it in a .htaccess file. See http://www.456bereastreet.com/archive/201103/x-ua-compatible_and_html5/ – Olly Hodgson Dec 12 '13 at 17:10
  • 2
    What was the answer to this question: "Where is the site being served from? Is it on your local network/intranet?" Also, open the IE11 console and hit refresh. The console should indicate why it's in IE7 mode. – Dave Methvin Dec 12 '13 at 20:12
  • Thx @OllyHodgson, you're tip mentioning using the .htaccess file works and is good enough for me...I just don't know how to upvote your comment – diedie2 Dec 13 '13 at 16:10
4

This is how I fixed my issue. Works great.

<system.webServer>
    <httpProtocol>
        <customHeaders>
            <clear />
            <add name="X-UA-Compatible" value="IE=edge" />
        </customHeaders>
    </httpProtocol>
Don Rolling
  • 2,301
  • 4
  • 30
  • 27