English Japanese Kawa.netxp [JavaScript] data: scheme URI generator / base64-encoded image file

The data: scheme can contain binary data such as image.
Firefox and Opera supports the data: scheme, but IE doesn't yet.

Try it!

Image's URL:
|||

|||
Generated JavaScript source code:

|||
Image via data scheme:
image will be here.

How to use it

<img id="icon_here">
<script>
    var data = 'data:image/gif;base64,'+
        'R0lGODlhAAEwAMQAAJ2M5Me98GRK1DoYyYBr3PHv++Pe99XO81Y50auc6PBkZEgpzbmt7HJa2I57'+
                // snip //
        'fS3CqU7XGYgE+GqHvrLJ8Tr6qXmqiwAF9CffgnMNqmWHAWNBwwGsKpKsrmJqltOOV69nuYxSkqpo'+
        'Tata18rWtrr1rTIIAQA7';
    var icon_elem = document.getElementById("icon_here");
    icon_elem.src = data;
</script>

Comments by AjaxCom

Links

Trackbacks by AjaxTB

Trackback URL:http://www.kawa.net/service/tb/ajaxtb.cgi/works/js/data-scheme/base64-e.html

Kawa.netxp © Copyright 2006 Yusuke Kawasaki