HTML5 Doctype, Validation, X-UA-Compatible, and Why Do I Hate Hackers
I'm giving up on HTML validation. FAAK the W3C. FAAK Google. FAAK Apple. FAAK Microsoft. FAAK Firefox.
In the past 10 years, i've been quite strict and stern about HTML validation. However, every little thing you do run into problems. In embedding YouTube videos, in adding Google search widgets, adding Comment System, in embedding Twitter or Facebook widgets, in adding ads, in mirroring documents from other sources (e.g. Emacs Lisp Manual.)…. Normally, it might take 5 min to do a job. But with concern about correct HTML, it takes n hours to research and find a solution that work across browsers yet still correct. See:
- HTML Correctness and Validators
- Google Earth KML Invalid
- Google and Amazon Generates Invalid HTML
- W3C HTML Validator Invalid
- How to Embed Video with Valid HTML
- Programing: GNU Texinfo Problems; Invalid HTML
What made the situation worse is that every elite programing idiot (aka “hacker”) will insist on how validation is important and tell you how you should use HTML this or that way, as if reality doesn't exist.
Worse is that supposedly the “good guys” big companies {Google, Apple} now peddle HTML5 because it would benefit THEMSELVES, while completely ignore anything about validation. They — in particular the “be no evil” Google — do not even pay lip service to validation.
(Google is trying to overtake the world and run-over Microsoft with the web. They won't be able do that unless web tech supports traditional desktop functionalities, that's why they need to push HTML5. Apple do it for the same reason for their iPad iPhone mobile money-cow.)
What is HTML5? It's a flying-faak-in-your-face against a decade of what W3C told us about what HTML should or should not be. HTML5 was started by mostly Google and Apple, and in the beginning was sneered by W3C, but W3C finally lost the power struggle and accepted HTML5.
You know? W3C is like United Nations. It was supposed to be this neutral standard body. But in fact it really is just a masked face of the powers. The distinction between good for the masses and the powers behind the org, gets thin over the years.
The situation is not much different than the 1990s where the leading companies push new tech to gain market. (e.g. Netscape with <blink>
, <font>
, JavaScript, cookies, frames, etc, Microsoft with marquees, Favicon, etc.)
- Internet History, Netscape, Dot Com, Code Rush 📺
- HTML History Timeline
- Cookies, Super Cookies, Your Privacy
The difference is that this time, the new stuff is sold as a “standard”, and the tech geekers went along applauding.
How to Make Your Site IE Compatible with X-UA-Compatible
What prompted me to write this rant on this topic AGAIN? Well, when i view my site with Internet Explorer 9 (IE9) — this sparkling new, standard-compliant, HTML5-aware browser, it shows a little ugly icon of broken page in the URL field. Curiously, that icon doesn't show when viewing Google, Apple, or Microsoft sites. So i took a bit to investigate, which inevitably ends up several hours spent.
The matter is not simple as usual just like every cranny of html/css. But basically, if your site doesn't include a “X-UA-Compatible” meta-tag, then that icon will most likely show up, even if you use the “html5 doctype” and all your page is valid and pretty simple and doesn't use any CSS/js/browser-sniffing/quirksmode or whatnot hack.
So my dilemma is, if my completely W3C-valid HTML4 strict site with extremely simple and static markup, do i need to cave-in to whatever some company is doing and add that “X-UA-Compatible” non-standard stupid extra little string just so that IE won't show that little ugly broken-page icon?
I looked at what other big sites do.
Here is Apple.com:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="Author" content="Apple Inc." /> <meta name="viewport" content="width=1024" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, IE=9" /> …
Here is google.com when served to IE9:
<!doctype html><html><head><meta http-equiv="X-UA-Compatible" content="IE=8"><meta http-equiv="content-type" content="text/html; charset=UTF-8">…
Here is microsoft.com:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:bi="urn:bi" xmlns:csp="urn:csp"><head><title>…</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> …
Here is Wikipedia, which does not use the “X-UA-Compatible” and the broken-page icon shows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>…</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> …
Note, Wikipedia is one of the few most trafficked site that uses valid HTML/XHTML, in the few times i've checked since ~2005. (but the few times i've checked in the past year they seem to have slacked.)
The “X-UA-Compatible” was introduced with IE8. (in contrast to typical tech geekers, i don't blame Microsoft for it) Here's Microsoft's official doc about it: Defining Document Compatibility At Source msdn.microsoft.com
Here is a very short summary. Use one of:
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=9"> <meta http-equiv="X-UA-Compatible" content="IE=8"> <meta http-equiv="X-UA-Compatible" content="IE=7"> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> <meta http-equiv="X-UA-Compatible" content="IE=5">
What is the difference between “IE=7” and “IE=EmulateIE7”?
It's not clear to me from scanning that long article, but then i found this Microsoft blog: Introducing IE=EmulateIE7 By Jefferson Fletcher (IE product manager) of ieblog. At http://blogs.msdn.com/b/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx. Quote:
Content Value Details IE=7 Display in IE7 Standards mode; Already supported in the IE8 Beta 1 release IE=EmulateIE7 Display standards DOCTYPEs in IE7 Standards mode; Display quirks DOCTYPEs in Quirks mode; Available through the IE June Security Update for IE8 Beta 1
Complexer and Complexer
There is a mantra, widely purveyed among web communities from unix idiots throughout 1990s up to early 2000s.
It's from Unix's RFC (aka Really Faaking Common), number seven hundred ninety three, under the section “Robustness Principle”: «be conservative in what you do, be liberal in what you accept from others». Typically quoted as:
Be conservative in what you send; be liberal in what you accept. — Jon Postel
This quote was often appended as a pithy quote in sign-off signatures of online postings in web tech forums for over 10 years.
If you ever wonder why web tech is so faaked up, you have to thank these tech geeking idiots. 〔see The Nature of the Unix Philosophy〕