bellyphantFeed

Data URL format

Well, I never — never knew about Data URLs, that is. This is probably old news for a lot of people, but it’s something I missed; I have no idea when they came about. Data URLs lets you encode random data into URLs — essentially the URL is the data, rather than a link to it. Here’s an example:

data:text/plain,hello world

If you follow that link in Opera or Firefox, you’ll get a “hello world” document. Obviously you can also do HTML:

data:text/html,<html><body><h1>hello world</h1></body></html>

And you can use Base64 encoding (this is the same as the previous HTML example):

data:text/html;base64,PGh0bWw+PGJvZHk+PGgxPmhlbGxvIHdvcmxkPC9oMT48L2JvZHk+PC9odG1sPg==

Clearly by using Base64, you can actually encode anything you like. Such as this example from Mozilla.org:

data:image/png;base64,... long Base64 bit here ...

Lots of fun! You can also save your HTML <CANVAS> tag drawings to this format, using toDataURL(). Now I just have to think of some way to use this stuff. Note that (naturally) it doesn’t work in Internet Explorer.

Simon Russell is a software developer from Canberra currently living in London.

Links

Me in other places

Photoblogs

Friends' blogs

Stuff I read

I have to check my RSS reader to finish these links...

Recently del.icio.us links >>

del.icio.us tags