js check to see if user has connection
Is there an easy way to check whether or not the user has connection to your website?
See if they开发者_高级运维 don't get a connection error.
You can create a simple service or page on your website and you can send a XmlHttpRequest (XHR) to your site and make sure you receive a valid 200 response.
You can make an AJAX request with a specified timeout that checks to see if you get back a valid response (code 200).
精彩评论