Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript image onError in case of non 200 response

I have to count image loading time. onLoadHandler is responsible for it.

<img onError="onErrorHandler(this);" onLoad="onLoadHandler(this);" alt="" border='0' width='1' height='1'   src='http://exmaple.com/02.jpg'/>

It is works fine if image is normal file with 200 server response.

But partners provide chain of 302 redirects, and onError fires on first redirect. So i never get real loading image time.

Is there some workaround?

Thanks

like image 469
Lev Savranskiy Avatar asked May 31 '11 13:05

Lev Savranskiy


1 Answers

Is the size of the image that you're redirected to the same size as the image you requested? If not, you can use this to detect an error.

like image 160
Ewout Kleinsmann Avatar answered Oct 05 '22 22:10

Ewout Kleinsmann