javascript - IE8 not displaying images (red x) ... sometimes -


i'm going mad following problem not happen on other browser (chrome, firefox):

  • ie8 cache cleared
  • browser starts opens html/javascript page requests , creates few images dynamically. html page served tomcat server localhost:8084.
  • most of time out of 10 images requested ie displays red x.
  • developer image report (f12) shows images "file size" correct # bytes, yet image still not displayed, or images file size "unknown bytes" , image doesn't work.
  • sometimes 2-4 out of 10 images show , rest fail!
  • sometimes in mad fury of hitting refresh 1 billion times, images show up.
  • the real kicker when put break point in http server, socket isn't opened. ie isn't attempting fetch images server before failing.
  • and if run same code request image somewhere google maps, works in ie without problems.

here's javascript code:

<script type="text/javascript">     var ctr = 0;     function getimage(url)     {         var img = document.createelement("img");         img.src = url + "&nc=" + ctr;         ctr ++;         img.width = 128;         img.height = 128;         document.body.appendchild(img);     }      (var = 0; < 10; i=i+1)     {         //this fails of time         settimeout("getimage('http://myhostname:9980/generateimagestatic?parameter=1')", 1000);         //this works! why?         //settimeout("getimage('http://maps.google.com:80/maps/api/staticmap?center=brooklyn+bridge,new+york,ny&zoom=14&size=512x512&maptype=roadmap&markers=color:blue|label:s|40.702147,-74.015794&markers=color:green|label:g|40.711614,-74.012318&markers=color:red|color:red|label:c|40.718217,-73.998284&sensor=false')", 1000);     } </script> 

for http server i'm using boost sample asio http server link modified uri request, sends png file (i've tried various files make sure it's not png encoding that's bad). http header has content-type: "image/png". correct mime type sent.

i've been trying find solution long time. read through various posts:

  • mime type problem. mime type not problem in case. set content-type. i've used firefox livehttpheader plugin view headers sent server. except cache control headers, headers same google sends in terms of content-type:
  • security error. ok maybe cross domain images security risk. or blocking request. why doesn't fail 100% of time?! why ie not request cross domain images? yet maps.google.com request works, , mine works sometimes. same applies firewall or anti-virus. i've tried running server on various ports (80, 8080, 9980).
  • javascript error. think javascript correct. getting same problem gwt. thought gwt problem. , there event bug ie , gwt related images. simplified code javascript. no gwt.
  • maybe it's c++ http server implementation. it's possibility. firefox , chrome work same code without problems.

any ideas? thanks.

edit added myhostname trusted sites. lowered security settings low internal , internet sites. i'm going try disable keepalive on server if enabled. mentioned don't see ie making attempt fetch image @ all. socket doesn't receive requests ie, removing keep-alive headers may not help.

check color mode images in.

i have accidentally switched color mode of image rgb8 cmyk in photoshop, , ran same problem. ie8 fail display image, while firefox have no trouble @ all.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -