title: How to check if a URL is accessible from a PC?
body: <p>We are using struts 1.3 in our application. We have a requirement as stated below -</p>
  
  <p>We have button in login page. Now,</p>
  
  <ol>
  <li>If a url is accessible from the user PC, show the button.</li>
  <li>Otherwise don't show it.</li>
  </ol>
  
  <p>To check the URL accessibility, I am using XMLHttpRequest.responseText. Below is my code :</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Test html page&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
        function checkURL()
        {
          var xmlHttp = null;
          var theUrl = "http://www.googlewetuyyu.co.in";
          xmlHttp = new XMLHttpRequest();
          xmlHttp.open( "GET", theUrl, false );
          alert(xmlHttp.responseText);
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body onload="checkURL();"&gt;
      &lt;b&gt;Hello World!&lt;/b&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But still I am getting nothing in alert box.</p>
  
  <p>[I am modifying a little bit]</p>
  
  <p>It's actually working in IE. But not working in chrome. Please suggest a solution.</p>
  
  <p>Thanks, 
  Kartic</p>