[Javascript] Detect internet connection

Matt Barton javascript at mattbarton.org
Thu Feb 17 04:38:22 CST 2005


Just as an aside, that is a fantastic solution.  I like that a lot.

Matt


Paul Novitski wrote:

 >         <img id="checkcnx" src="" />
 >         ...
 >         var oImg = document.getElementById("checkcnx");
 >         oImg.src = oDate.getTime() + ".jpg"
 >
 > The img src is generated on the fly by Javascript and would always be 
different; this would trigger a 404 error (file not found) on the server 
which the server-side script could intercept, parse, and respond to by 
supplying an existing small (1kb).  Because the img src would change 
each time it was called, I think this would get around the image caching 
problem of a fixed uri.




More information about the Javascript mailing list