如何使用html jquery或java脚本无法连接互联网时显示对话框消息

问题描述:

如果在互联网连接不可用时单击登录按钮,我想显示一个对话框消息[“internet connection is avialable”] jQuery的或Java脚本如何使用html jquery或java脚本无法连接互联网时显示对话框消息

+0

您可以设置一个计时器定期运行的AJAX得到一个虚拟页面请求。在bool中存储它是成功还是失败,然后在用户单击登录按钮时检查该bool – 2012-03-30 04:29:47

+0

这可能会帮助您:http://stackoverflow.com/questions/2384167/check-if-internet-connection-exists-with -javascript – 2012-03-30 04:30:08

+0

http://stackoverflow.com/questions/189430/javascript-how-to-detect-that-the-internet-connection-is-offline – 2012-03-30 05:05:26

+0

我在移动apps.sonavigator.onLine不工作在移动webkit浏览器.. – Raj 2012-03-30 05:54:00