title: Javascript regular expression to add protocol to url string
body: <p>I have an application to list some website details using JavaScript. There will be a link to website which is generated using JavaScript itself. Sometimes I will get my link as,  </p>
  
  <pre><code>&lt;a href="http://www.google.com"&gt;Website&lt;/a&gt;
  </code></pre>
  
  <p>But sometimes it will be,</p>
  
  <pre><code>&lt;a href="www.yahoo.com"&gt;Website&lt;/a&gt;
  </code></pre>
  
  <p>In the second time the link is not working, there is no protocol.</p>
  
  <p>So I am looking for a JavaScript regular expression function to add http:// if there in no protocol.</p>
  
  <p>My code looks like, </p>
  
  <pre><code>var website_link = document.createElement("a"); 
  website_link.innerHTML = "Website"; 
  website_link.href = my_JSON_object.website;
  website_link.target = "_blank"; 
  profile.appendChild(website_link); 
  </code></pre>
  
  <p>And no local links will come.</p>