Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个混合移动应用程序,只想检查网络连接以便在线同步数据。我建议不要使用 JQuery/JQuery Mobile。任何帮助,将不胜感激。
您可以像这样使用 javascript 中的事件进行在线和离线。document.addEventListener("offline", yourCallbackFunction, false); document.addEventListener("在线", yourCallbackFunction, false);
document.addEventListener("online", onOnline, false); function onOnline{ //Handle the online event }