Forum Moderators: phranque
But is there a better way? How can one be notified of broken IMG SRC links?
Thank you wise ones--
PB
Basically, you end each page with:
<script type="text/javascript">chkI()</script>
function chkI(){
function imgE(e){
e=e¦¦event;
e=e.target¦¦e.srcElement;
if(e.Cap)return;
e.OK=0;e.Cap=1
}function imgOK(e){
e=e¦¦event;
e=e.target¦¦e.srcElement;
e.OK=1;e.Cap=1
}for (var i=0,e;e=document.images[ i ];i++) {addEvent(e,'error',imgE);addEvent(e,'load',imgOK)}
}
addEvent() is a standardized method for addEventListener() (Mozilla) and attachEvent() (IE)
You add a body.onload event that loops through the images and detects which have failed. Once done, you can report failed urls to your server by requesting a dummy image with urls as parameters (after '?').
When you parse you server logs you'll notice all image errors (temporary and permanent).
[edited by: Achernar at 5:23 pm (utc) on April 15, 2008]