title: how to check if the user has the connection to the internet
body: <p>In my page,I have to read the weather information from a third part site,then show the weather in the <code>div</code> if the user has the connection to the internet. If not,I will show some local content instead. So I have to check if the user have the connection.</p>
  
  <p>Some people said that if the user can see my page,they must be have the connection. However it is not true all the time,since our application may run in the local network,so they can get the resource in our site but not the resource in the internet.</p>
  
  <p>I have thougth use this manner:add the following code in the head of the page:</p>
  
  <pre><code>&lt;head&gt;
      &lt;script src="http://www.google.com/xxx/jquery.min.xx.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        window.onload=function(){
          if($){
            //the jquery is loaded,the client muse have the connection to the internet.
          } else
            //show local content
        }
  
      &lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>However,in our page we have used the prototype ,if the jquery is loaded successfully,it may cause conflict.</p>
  
  <p>Any idea?</p>
  
  <p>NOTE:
  we do not need the jquery in our page,here I load the jquery just for test the connection,if possible, I can load anyother lib .</p>
  
  <p>Now,I find an idea:</p>
  
  <p>if google host a js file internet.js,just one line:</p>
  
  <pre><code>var xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="xx";
  </code></pre>
  
  <p>Then I requset this file ,to test if the "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" variale is defined. :)))</p>