|
Hallo!!
According to my previous post with popups hanging, now I'm trying to bypass
this strange behaviour using loading JavaScript image not by image.src=URL
but straight away from stream using HTTP GET method.
The problem is, how to assign stream from downloaded image (ex. GIF89a) to a
JavaScript Image object ?
Below is my code with explanation what I'm trying to do:
<script type="text/javascript">
var xmlhttp;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
var ids = ["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0",
"Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
for(var i=0; !xmlhttp && i<ids.length; i++) { try { xmlhttp = new
ActiveXObject(ids[i]); } catch(ex) { xmlhttp = false; } }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new
XMLHttpRequest(); }
if (xmlhttp) {
xmlhttp.open("GET","http://test2/load?BINARY_ID=42311183",true); //zczytuje
obrazek
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) { //downloading complete!
alert(xmlhttp.responseText); // is OK image is loaded type is GIF89a
obrazek = new Image(); // OK
obrazek = xmlhttp.responseBody; // this is my dream !!!!! heheh
alert(obrazek.width); //it's null of course, and my dream is that
obrazek.width should equal to real image readed from HTTP stream.
document.getElementById("document_image")=obrazek; //another dream, where
document_image is an image declared in HTML body as <img
id="document_image">
}
}
xmlhttp.send(null);
}
</script>
Thanks for any help, solution, info!!!
Serge! |