Having fun with IE - part 3: doctype switching

By crisp on Friday 01 December 2006 00:51
Category: Browsers, Views: 538

Part 3 of this serie; today: doctype-switching.

This is about doctype switching in IE:


HTML:
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
triggers quirksmode because there is no version URI present

HTML:
1
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
triggers standards-compliant mode because the version URI is present

But what exactly is a URI?

HTML:
1
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://tweakers.net">
yep, that's a URI, so we render in standards-compliant mode

HTML:
1
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "some gibberish">
nope, that's not a URI, so we render in quirksmode

HTML:
1
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "some gibberish http://">
sure, standards-compliant mode because it contains http:// so it must also be a URI...

Now let's just hope W3 doesn't decide to use a different protocol for the latest versions of their document type definitions:

HTML:
1
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "ftp://www.w3.org/TR/html4/loose.dtd">
doesn't contain http:// anywhere, so surely this can't be a valid URI...

Volgende: Capability detection - the better way 03-12
Volgende: About the cube 01-12

Comments

There are no comments for this post


Comment form
(required)
(required, but will not be displayed)
(optional)

Please enter the characters you see in the image below: