razorborg

Modernizr, IE8, X-UA-Compatible, and Standards Mode

Jan Martin Borgersen
September 24th, 2013 · 1 min read

Heres a quick tip for folks using Modernizr for client browser detection (or any other script that puts comment blocks around your HTML tag), and you need to ensure that that IE8 renders in standards mode.

Set X-UA-Compatible (value: IE=10;IE=9;IE=8, or just IE=Edge) in your HTTP Headers, not in a META tag.

It turns out that IE8 sees the Modernizer comments in the html and throws itself into compatibility mode before it sees the tag, and once youre in compatibility mode, the user has to override their own browser settings for your website to get themselves back into standards mode. However, if you send the X-UA-Compatible setting in the HTTP Headers, IE8 sees that first, and sticks in standards mode.

This is discussed briefly here at StackOverflow.

More articles from Jan Martin Borgersen

John Maeda: How art, technology and design inform creative leaders | Video on TED.com

John Maeda: How art, technology and design inform creative leaders | Video on TED.com I love this talk. It should be on my blog. John Maeda…

May 24th, 2013 · 1 min read

Drive: The surprising truth about what motivates us (by theRSAorg)

April 29th, 2013 · min read
© 2003–2020 Jan Martin Borgersen.
Stock photography from Unsplash.
Built with Gatsby. Hosted with Netlify. Theme based on Novela by Narative.
Link to $https://github.com/razorborgLink to $https://www.linkedin.com/in/jborgersen/