There is advice that says the meta-tag declaring encoding should be as early as possible, preferably first in the head like so:
<head>
<meta charset="utf-" /><!-- Yes I like XHTML syntax, get over it -->
<title></title>
<!-- The usual suspects -->
</head>
Now I wonder if it has any discernible effect where in this flow I put
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Possible problems/issues that I've not read any research about:
Instinct tells me to put the meta-tag as early as possible, but are there any hard evidence?
Not a hard evidence, but a theory of mine: since the Document does not yet have a body, no paints or flows have been made after the head element is finished. When the body element is parsed and painting begins, the X-UA-Compatible
directives should have been dealt with already. So when it comes Stylesheets, it should not matter.
Scripts, however, are blocking parsing and will be executed when they shows up, unless they use the defer
attribute and the IE version supports it.
One could argue that delayed callbacks gets the change, though; I have onContentLoaded
callbacks, window.onload
callbacks and callbacks wrapped with setTimeout
in mind. So when it comes to script, the position of X-UA-Compatible
meta matters. It would be really interesting to do some testing with this.
If scripts are placed at the bottom of the body element, like Souders recommends, it should not be a problem though.
At the end of the day, the most bulletproof solution is to skip meta elements and instead use HTTP headers. That is what I would do.