A bookmarklet: dataURI, please!

  • You are here: Free PHP » Uncategorized » A bookmarklet: dataURI, please!

Ever had a string of a data URI image and you want to see said image? Simple: type data:image/png;base64, followed by the base 64 string. Except... it's too much syntax to remember. I mean c'mon: colon, semi-colon, comma. And you probably don't do this often enough. A bookmarklet is called for to aid the memory. Here goes:

location='data:image/png;base64,'+prompt('dataURIplz:');

Yup.

If you think this is a good idea, drag this link to your bookmarks.

dataURIplz

Bye!

Update

p.s. Doesn't work in Chrome, because you're "Not allowed to navigate top frame to data URL". If it's that important to you, maybe change the bookmarklet code to do something like:

var i = new Image();
i.src = 'data:image/png;base64,'+prompt('dataURIplz:');
document.body.innerHTML = i.innerHTML;

p.p.s. Yup, some of us write up a whole thing about a chunk of code and only then test it in that other browser that peeps seem to use.

Powered by Gewgley