Skip to main content

4. Examples

A data URL might be used for arbitrary types of data. The URL

data:,A%20brief%20note

encodes the text/plain string "A brief note", which might be useful in a footnote link.

The HTML fragment:

<IMG
SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7"
ALT="Larry">

could be used for a small inline image in a HTML document. (The embedded image is probably near the limit of utility. For anything else larger, data URLs are likely to be inappropriate.)

A data URL scheme's media type specification can include other parameters; for example, one might specify a charset parameter.

data:text/plain;charset=iso-8859-7,%be%fg%be

can be used for a short sequence of greek characters.

Some applications may use the "data" URL scheme in order to provide setup parameters for other kinds of networking applications. For example, one might create a media type

application/vnd-xxx-query

whose content consists of a query string and a database identifier for the "xxx" vendor's databases. A URL of the form:

data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local

could then be used in a local application to launch the "helper" for application/vnd-xxx-query and give it the immediate data included.