Return to Snippet

Revision: 48872
at July 30, 2011 18:03 by devnull69


Updated Code
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET",url,false);
xmlhttp.overrideMimeType('text/plain; charset=x-user-defined');
xmlhttp.send();
var data = '';
for ( var i = 0; i < xmlhttp.responseText.length; i++ ) data += String.fromCharCode( ( xmlhttp.responseText[ i ].charCodeAt(0) & 0xff ) );
// Convert raw data to base64
data = btoa( data );
var base64src='data:image/jpg;base64,'+data;  // change the MIME type according to content

Revision: 48871
at July 12, 2011 06:28 by devnull69


Initial Code
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET",url,false);
xmlhttp.overrideMimeType('text/plain; charset=x-user-defined');
xmlhttp.send();
var data = '';
for ( var i = 0; i < xmlhttp.responseText.length; i++ ) data += String.fromCharCode( ( xmlhttp.responseText[ i ].charCodeAt(0) & 0xff ) );
// Convert raw data to base64
data = btoa( data );
var base64src='data:image/jpg;base64,'+data;

Initial URL

                                

Initial Description

                                

Initial Title
Load external binary data as data url

Initial Tags
image

Initial Language
JavaScript