Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the HTML Doctype URL downloaded by the client browser?

Tags:

html

doctype

I was just wondering when I declare a Doctype such as the following:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Is strict.dtd read from http://www.w3.org/TR/html4/ or is this just used as an obscure id to tell the browser to use strict processing?

Maybe the browser keeps the content of http://www.w3.org/TR/html4/ permanently stored locally?

like image 930
toc777 Avatar asked Jan 21 '11 11:01

toc777


2 Answers

Normal web browsers treat the Doctype as nothing more than a magic string to indicate standards mode or quirks mode. They do not treat the URI as a URI and never download the DTD. They don't even use the DTD for parsing, having a tag soup parser built in instead.

Validating parsers do download it if they don't have a local copy which they can identify based on the PUBLIC identifier (the URI is the SYSTEM identifier). They should cache it, but lots don't, to the point where the W3C block most (if not all) requests for the DTD at the URIs given in the Doctypes — they couldn't afford the bandwidth.

like image 78
Quentin Avatar answered Nov 15 '22 06:11

Quentin


This is an extract from the wikipedia page for "DTD"

Since web browsers are implemented with special-purpose HTML parsers, rather than general-purpose DTD-based parsers, they don't use DTDs and will never access them even if a URL is provided

like image 20
Clyde Lobo Avatar answered Nov 15 '22 04:11

Clyde Lobo