sajad torkamani

In a nutshell

A Data URL is a URL prefixed with the data: schema that lets you embed small files inline. It has the following syntax:

data:[<mediatype>][;base64-token],<data>
  • mediatype: A MIME type (e.g., image/png). Defaults to text/plain;charset-US-ASCII
  • base64-token: Needed for non-textual data
  • data: The base64 encoded string

Reserved characters, spaces, newline characters, and other non-printing characters must be percent-encoded.

Examples

Plain text

data:,Hello%2C%20World%21

Base 64 encoded version of text

data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==

HTML document

data:text/html,%3Ch1%3EHello%2C%20World%21%3C%2Fh1%3E

Sources

Tagged: HTTP