Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You dont need a plugin for that, simply do:</p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; if (! window.jQuery) { alert('No internet Connection !!'); } else { // internet connected } &lt;/script&gt; </code></pre> <p>The reason why above works is because jQuery lib is read from google CDN for which internet connection is required, if page can not read it, it means internet connection isn't there.</p> <h2>Update</h2> <p>You can do something like:</p> <pre><code>function checkConnection() { var connected = true; var img = document.createElement('img'); img.src = "path to remoate image on your server"; img.onerror = function() { connected = false; } return connected; } </code></pre> <p>You can use it like this at any time:</p> <pre><code>if (checkConnection()) { // connected } </code></pre> <h2>Update 2</h2> <p>You can periodically/automatically check for it too like this:</p> <pre><code>setInterval(function(){ var isConnected = checkConnection(); // checkConnection() comes from above code if (isConnected) { alert('Connected'); } else { alert('Not Connected'); } }, 10000); // 10000 = 10 seconds, check for connection every 10 seconds </code></pre> <hr> <p><strong>Other useful links:</strong></p> <ul> <li><a href="https://stackoverflow.com/questions/2384167/check-if-internet-connection-exists-with-javascript">Check if Internet Connection Exists with Javascript?</a></li> <li><a href="https://stackoverflow.com/questions/5626832/jquery-mobile-detected-if-theres-internet-connection">JQuery Mobile Detected if there's internet Connection</a></li> <li><a href="http://tomriley.net/blog/archives/111" rel="nofollow noreferrer">checkNet: My jQuery plugin for detecting Internet connection</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload