I am currently creating a Cached iPhone application with some features that require the Internet and other features that do not. I would like to know how to detect an Internet connection with JavaScript so that the text “No Internet connection” is displayed on certain pages, and others as usual.
In HTML5 you can use:
navigator.onLine
to detect your internet connection.
LIVE DEMO: http://jsfiddle.net/DerekL/fHQK4/
You can make iframe and install src in google. If it does not start the download in seconds, they probably do not have internet.