Data URLs LeoSavernik
l.savernik@aon.at
MalcolmHunter
malcolm.hunter@gmx.co.uk
Conversion to British English
2003-02-06
Data URLs allow small document data to be included in the URL itself. This is useful for very small HTML testcases or other occasions that do not justify a document of their own. data:,foobar (note the comma after the colon) will deliver a text document that contains nothing but foobar The last example delivered a text document. For HTML documents one has to specify the MIME type text/html: data:text/html,<title>Testcase</title><p>This is a testcase</p>. This will produce exactly the same output as if the content had been loaded from a document of its own. Specifying alternate character sets is also possible. Note that 8-Bit characters have to be escaped by a percentage sign and their two-digit hexadecimal codes: data:;charset=iso-8859-1,Gr%FC%DFe aus Schl%E4gl results in Grüße aus Schlägl whereas omitting the charset attribute might lead to something like Gr??e aus Schl?gl IETF RFC2397 provides more information.