This book is about HTML5, not previous versions of HTML, and not any version of XHTML. But to understand the history of HTML5 and the motivations behind it, you need to understand a few technical details first. Specifically, MIME types.
Every time your web browser requests a page, the web server
sends a number of headers before it sends the actual page markup. These
headers are normally invisible, although there are a number of web
development tools that will make them visible if youâre interested. The
headers are important, because they tell your browser how to interpret the
page markup that follows. The most important header is called Content-Type
, and it looks like this:
Content-Type: text/html
text/html
is called the âcontent
typeâ or âMIME typeâ of the page. This header is the
only thing that determines what a particular resource
truly is, and therefore how it should be rendered. Images have their own
MIME types (image/jpeg
for JPEG images, image/png
for PNG images, and
so on). JavaScript files have their own MIME type.
CSS stylesheets have their own MIME
type. Everything has its own MIME type. The Web runs on
MIME types.
Of course, reality is more complicated than that. Very early web
servers (Iâm talking web servers from 1993) didnât send the Content-Type
header, because it didnât exist
yet. (It wasnât invented until 1994.) For compatibility reasons that date
all the way back to 1993, some popular web browsers will ignore the
Content-Type
header under certain
circumstances. (This is called âcontent sniffing.â) But as a general rule
of thumb, everything youâve ever looked at on the
WebâHTML pages, images, scripts, videos, PDFs, anything
with a URLâhas been served to you with a specific
MIME type in the Content-Type
header.
Tuck that under your hat. Weâll come back to it.
Get HTML5: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.