title: get html source code
body: <p>I am trying to put the html source code for any webpage in a string using Javascript.
  Please tell me if i can do something else to solve my problem..
  I am using the following code that i found from another <a href="https://stackoverflow.com/questions/247483/http-get-request-in-javascript/4033310#4033310">post</a></p>
  
  <pre><code>function httpGet(theUrl)
  {
  var xmlHttp = null;
  
  xmlHttp = new XMLHttpRequest();
  xmlHttp.open( "GET", theUrl, false );
  xmlHttp.send( null );
  return xmlHttp.responseText;
  }
  </code></pre>
  
  <p>I tried this in IE Firefox and Chrome but i always get the following source code which is the source code for "PAGE NOT FOUND" page..If you any other info please let me know in a comment..
  What i am trying is to get html from any webpage like google.com and other webpages..If i can't do that then what can i do?</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head profile="http://gmpg.org/xfn/11"&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
      &lt;title&gt;404 - PAGE NOT FOUND&lt;/title&gt;
              &lt;style type="text/css"&gt;
              body{padding:0;margin:0;font-family:helvetica;}
              #container{margin:20px auto;width:868px;}
              #container #top404{background-image:url('http://74.53.143.237/images/404top.gif');background-repeat:no-repeat;width:868px;height:168px;}
              #container #mid404{background-image:url('http://74.53.143.237/images/404mid.gif');background-repeat:repeat-y;width:868px;}
              #container #mid404 #gatorbottom{position:relative;left:39px;float:left;}
              #container #mid404 #xxx{float:left;padding:40px 237px 10px;}
              #container #mid404 #content{float:left;text-align:center;width:868px;}
              #container #mid404 #content #errorcode{font-size:30px;font-weight:800;}
              #container #mid404 #content p{font-weight:800;}
              #container #mid404 #content #banner{margin:20px 0 0 ;}
              #container #mid404 #content #hostedby{font-weight:800;font-size:25px;font-style:italic;margin:20px 0 0;}
              #container #mid404 #content #coupon{color:#AB0000;font-size:22px;font-style:italic;}
              #container #mid404 #content #getstarted a{color:#AB0000;font-size:31px;font-style:italic;font-weight:800;}
              #container #mid404 #content #getstarted {margin:0 0 35px;}
              #container #bottom404{background-image:url('http://74.53.143.237/images/404bottom.gif');background-repeat:no-repeat;width:868px;height:14px;}
              &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="container"&gt;
      &lt;div id="top404"&gt;&lt;/div&gt;
      &lt;div id="mid404"&gt;
  
              &lt;div id="gatorbottom"&gt;&lt;img src="http://74.53.143.237/images/gatorbottom.png" alt="" /&gt;&lt;/div&gt;
              &lt;div id="xxx"&gt;&lt;img src="http://74.53.143.237/images/x.png" alt="" /&gt;&lt;/div&gt;
      &lt;div id="content"&gt;
              &lt;div id="errorcode"&gt;ERROR 404 - PAGE NOT FOUND&lt;/div&gt;
              &lt;p&gt;Oops! Looks like the page you're looking for was moved or never existed.&lt;br /&gt;Make sure you typed the correct URL or followed a valid link.&lt;/p&gt;
  
              &lt;div id="banner"&gt;
  
                      &lt;object width="728" height="90"&gt;&lt;param name="movie" value="http://74.53.143.237/images/hg728x90.swf"&gt;
  
                              &lt;embed src="http://74.53.143.237/images/hg728x90.swf?clickTAG=http://secure.hostgator.com/cgi-bin/affiliates/clickthru.cgi?id=page404" width="728" height="90"&gt;&lt;/embed&gt;
                      &lt;/object&gt;
              &lt;/div&gt;
  
              &lt;div id="hostedby"&gt;This site is hosted by HostGator!&lt;/div&gt;
              &lt;div id="coupon"&gt;Build your website today for 1 cent!   Coupon code: "404PAGE"&lt;/div&gt;
  
              &lt;div id="getstarted"&gt;&lt;a href="http://www.hostgator.com/?utm_source=internal&amp;utm_medium=link&amp;utm_campaign=page404" title="HostGator Web Hosting" &gt;CLICK HERE TO GET STARTED&lt;/a&gt;&lt;/div&gt;
  
      &lt;/div&gt;
  
      &lt;div style="clear:left;"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="bottom404"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>