how to verify is a website is up using javascript
-
We have a web page with some javascript that displays information from an external site, occassionally, the external website is down and that slows down our site. We would like to either be able to test if the site is up before executing the javascript code, or implement some form of timeout mechanism (not what is defined as timeOut in javascript, which is really a sleep function), it would actually mean that if the website doesn't respond in a certain interval of time, we could either show a message or just bypass the execution all together. I haven't been able to find anything on this, any ideas?
-
We have a web page with some javascript that displays information from an external site, occassionally, the external website is down and that slows down our site. We would like to either be able to test if the site is up before executing the javascript code, or implement some form of timeout mechanism (not what is defined as timeOut in javascript, which is really a sleep function), it would actually mean that if the website doesn't respond in a certain interval of time, we could either show a message or just bypass the execution all together. I haven't been able to find anything on this, any ideas?
Send a dummy XmlHttpRequest to the resource and you can examine the status code. Vasudevan Deepak Kumar Personal Web: http://www.lavanyadeepak.tk/ I Blog At: http://www.dotnetjunkies.com/weblog/deepak/
http://deepakvasudevan.blogspot.com/
http://deepak.blogdrive.com/