JQuery Mobile Detected if there's internet Connection
问题 What is the best way to detect if there's internet connection or not on my mobile via my web app? 回答1: There's no code necessary for this -- it's part of the HTML5 API. Check the value of window.navigator.onLine -- it will be false if the user is offline. http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#browser-state 回答2: An option might be changing the Ajax settings to add a specific timeout , then add an error handler that looks for a textStatus (second argument) of