Sometimes you like to think that you pretty much know everything there is to know about URIs and web browsers. I learned something today that I had absolutely no idea about before. The magic data URL protocol.
It’s defined in RFC2397 as a way to include immediate data in a URL.
For example the following defines an inline GIF image in a base64 encoding:

<IMG SRC="data:image/gif;base64,
yAhJZ1/0TxR9dxjeNnkBOFrkvJphu9wAAAAASUVORK5CYII=" ALT="Atlassian Dude">

Which, if your browser supports it, will render thusly:

Atlassian Dude

I only discovered this because Yahoo’s excellent YSlow extension for Firebug suggested replacing small, externally referenced images with data protocol representations.
Pretty neat.

Work smarter, better, and faster with weekly tips and how-tos.

Subscribe now