Posts tagged with “data uri”

What is Data URI scheme?

Sunday, 20 December, 2009
what is data uri scheme

Have you ever felt the need for holding an embedded image inside an HTML file, without referring to an external image file? Personally I felt like so many occasions, where the need for a completely self contained HTML page, with all its supporting images embedded within that page itself. This may seem pointless in normal situations, but it can prove very useful when we want to make a standalone page, that we can pass on to other people. We give them just one HTML file. They do not even need to unpack anything, they can simply open the file in their browser, and all the images and embedded objects are immediately displayed. They can do this even without an internet connection.

Below you can see two images first one is included in the traditional way by referring to an external file, and the later by using data URI.

myGravatar          myGravatar.gif

Try right-clicking the above images and check the file location in the properties panel. You can see the difference.

With Data URI (Uniform Resource Identifiers) we can easily do this.


What is Data URI Scheme?

Data URI scheme defined in IETF standard RFC 2397, as an URI scheme that allows inclusion of small data items inline, as if they were being referenced to as an external resource. They tend to be far simpler than alternative inclusion methods, such as MIME with cid: or mid: As per the wording in the RFC, data: URIs are in fact URLs, although they do not actually locate anything. Read the rest of this entry »