HTML5, Validation, Doctype, and Why Do I Hate Hackers

Perm url with updates: http://xahlee.org/js/html5_validation_doctype.html

HTML5 Doctype, Validation, X-UA-Compatible, and Why Do I Hate Hackers

Xah Lee, 2011-06-21

I'm giving up on html validation. Fuck the W3C. Fuck Google. Fuck Apple. Fuck Microsoft. Fuck 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:

What's worse is that every elite programing idiot (aka “hacker”) will insist how validation is important while completely ignoring reality.

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 “do 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 cannot 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 money-cow.)

What's HTML5? It's a flying-fuck-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 group, 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, etc.)

The difference is that this time, the new stuff is sold as a “standard”, and the Tech Geekers went along smiling.

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), it shows a little ugly icon of broken page in the url field. That broken page icon doesn't show for 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 html stuff. Basically, if your site doesn't include a “X-UA-Compatible” metatag such as <meta http-equiv="X-UA-Compatible" content="IE=9">, than that icon will show up, even if you use the “html5 doctype” <!doctype html> 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 valid html4 site with extremely simple 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?

So i also took a little time to check what other big sites do.

Here's 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's 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's 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's 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 2 years 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 (2011-04) @Source msdn.microsoft.com

Here's 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's 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 (2008-06-10) By Jefferson Fletcher (IE product manager) of ieblog. @ Source blogs.msdn.com. Quote:

Content ValueDetails
IE=7Display in IE7 Standards mode; Already supported in the IE8 Beta 1 release
IE=EmulateIE7Display 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 and even early 2000s.

It's from Unix's RFC (aka Really Fucking Common) #793, 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. It died off in early 2000.

If you ever wonder why web tech is so fucked up, you have to thank these idiots. (See: The Nature of the Unix Philosophy)

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs