1 The X-UA-Compatible
One of my post, Super Simple is still not HTML5 valid, has constantly been found on search engine since it got published and I felt very annoyed1 and sorry for those people who had visited that post. They wouldn’t find the answer they want, which is a solution to get rid of this error reported by W3C Validator:
The checked HTML source is from Blogger’s Super Simple template, since it’s an official template, which possibly most of Blogger bloggers would have such invalid code in their page source. I wrote my own HTML5 template, this blog doesn’t have such error, though still has a lot of other invalid codes which mostly contributed (injected) by Blogger.
So, the keyword (non-valid/standard pragma directive) here is X-UA-Compatible. It is made by Microsoft for their Internet Explorer, Version 8 to be precise, which I would like to call it as the most complicated and confusing web browser2 ever made. The author, Mark Pilgrim, of Dive into HTML5, has written about this on WHATWG blog:
The idea of version identifiers has been hashed and rehashed throughout the 5+ year process of defining HTML 5. Most notably, Microsoft proposed a version identif[i]er shortly after the W3C HTML Working Group reformed around HTML 5. Their proposal generated much discussion, but was not ultimately adopted. Several months later, Microsoft shipped Internet Explorer 8 with a “feature” called X-UA-Compatible, which serves as a kind of IE-specific version identifier. I am personally not a fan of this approach, in part because [PNG] it adds a lot of complexity for web developers who want to figure out why the still-dominant browser doesn’t render their content according to standards.
(emphasis added)
The fact is X-UA-Compatible is not, I emphasize it is NOT a standard. Currently, only five pragma directives and addition(s) are valid. Of course, Microsoft has tried to purpose, but then I read:
4.2.5.4 Other pragma directives
Extensions to the predefined set of pragma directives may, under certain conditions, be registered in the WHATWG Wiki PragmaExtensions page. [WHATWGWIKI]
Such extensions must use a name that is identical to an HTTP header registered in the Permanent Message Header Field Registry, and must have behavior identical to that described for the HTTP header. [IANAPERMHEADERS]
(emphasis added)
They have to get registered on IANA’s Permanent Message Header Field Names first. Which also mean, X-UA-Compatible is not a standard HTTP header, well, that’s what X- prefix for.
2 The Only Solution
So, the only way to get rid of that error message is to set up your web server to send such HTTP header. But mind you again, it’s not a standard and not even a common non-standard header. If you are an open and standard person, I strongly recommend you just forget this X-UA-Compatible, live with it or kick it out of your HTML source.
Once you have it sent using HTTP header, you can remove the naughty code from HTML source.
3 IE conditional comment trick?
At first, I thought we can use this dirty thing:
<!--[if ie]><meta content='IE=8' http-equiv='X-UA-Compatible'/><![endif]-->
Once again made by Microsoft. So, at least, we wouldn’t see the error message and it might still work for IE. It’s a valid HTML comment and W3C Validator doesn’t report that anymore.
However, it is only sort of working but not taking effective for mode setting in IE8, as I observed using IE’s developer tool. It means IE recognized that meta tag, the tag did show up in DOM tree, but specifying document compatibility doesn’t take effective. The reason could be this:
The X-UA-compatible header is not case sensitive; however, it must appear in the Web page’s header (the HEAD section) before all other elements, except for the title element and other meta elements.
It’s not appeared before other elements, in fact, it’s wrapped by HTML comment. Nice job, Microsoft, is there a security issue for the mighty IE conditional comment trick not working? Or just doing complicating once again?
4 So?
Please don’t give a dime to non-standard. Unfortunately, even Google does3 and use it. Now, two companies use it, but it’s still mainly for IE since Chrome Frame is for IE. The X-UA-Compatible is brought up solely for one specific web browser in my opinion.
Do I really care about any about it, nope. I wrote this post because I don’t like people visiting my blog and finding nothing useful, not even a slightly related information about what they are looking for. That really sucks, I could relate. If you have anything, please feel free to add or to correct me. I am sure stuff I wrote above might have some serious flaws.
Anyway, someday, we might see UA-Compatible or User-Agent-Compatible, but I would prefer call it UA-Complication. (I would be 200% thumbs-up for the last one since Microsoft is the only one needs to use it)
[1] | As of writing this post, within last 30 days, 207 Pageviews, 195 Unique Views, 00:03:31 Time on Page, 92.19% Bounce Rate, 91.79% % Exit. Sorry for those people, who wasted 3:31 minutes in their life. |
[2] | I call this Hell IE8! You can make it more complicated, Microsoft! |
[3] | http://www.chromium.org/developers/how-tos/chrome-frame-getting-started/chrome-frame-faq#TOC-How-can-I-enable-Google-Chrome-Frame-for-my-site- is gone. |
The font your using on your site is millions of times more annoying than IE8....
ReplyDeleteI knew I would get compliants! http://www.flickr.com/photos/livibetter/5426285933/
ReplyDeleteIt's planned for a couple of days. It will automatically get back it used to be. :)
There should be a special place in hell for Microsoft management, when they do such stupid things as this. They only need this tag because IE is so tied to the OS they can't get companies to upgrade. They should all be forced to use IE6 for the rest of there lives. Oh, wait...they still are!
ReplyDeleteI'm of the same thought, just skip it and take the consequences as they come. Standards should mean something, but won't if we just ignore them every time some idiot software company does.
Thanks for this article, though. I would never want IE8 to act like an earlier IE, and if the tag is not present, IE8 will go edge. Gonna kick this meta out of my head, literally.
ReplyDeleteAnyone see anything wrong with this (PHP-based) fix?
ReplyDelete'; } ?>
It should `echo ''? ;p
ReplyDeleteIt looks fine to me (haven't touched PHP for ages), what's the error if any?
PS. didn't expect PHP would ever be involved in this blog.
Oh, there's no error, it works fine. Was just wondering if anyone thought that was not really an acceptable way to handle the situation. I figure since PHP is rendering my header it isn't hard to just have it not show the “invalid” meta tag when it doesn’t need to be shown.
ReplyDeleteIt always is bad to *do* something for non-standard stuff.
ReplyDeleteBut what choice do we have if you still can't kick it out for $$$ issue. (Not literally about $$$)
And to be honest, I would just leave the tag there without using that dirty trick and forget W3C validation since it's only to fool self that your HTML is valid which is not.
thank it work, i keep searching for eliminated error for simple blogger template
ReplyDeleteI don't understand how your actually fixing it with that. Can you write out the full bit of code so we can see where you placed the unwanted meta tag?
ReplyDeleteI'm basically just hoping to copy paste your bit of code into the header where the meta tag would go and have it just work.
I edited @google-5b30530497db6704b7997bd9611ce236:disqus's comment, so now the PHP code is shown correctly.
ReplyDelete