I have written a small picture script which shows a directory listing with thumbnails and also previews of the pictures.
- Directory listing example
- Image preview example
- Source code
In some cases, when you click through several image previews (you can also use the arrow keys left/right to do that fa开发者_运维知识库ster), some images don't fully load (and they are only shown partly then).
I think this has started to appear more often since I am preloading the next few pictures but it also has appeared before. This also occurs most often if you switch the images very fast.
I wonder why this appears and how I can avoid this. I guess that the browser somehow looses some connection to the server (or the server closes it unexpectedly for some reason). Thus I tried to work around this by setting Content-Length
(and I was hoping that the browser would reconnect automatically if the file was not received fully) but that didn't helped.
Also, in the browser, a normal reload of the page doesn't help, I have to force a full reload.
精彩评论