title: How to add http:// if it doesn't exist in the URL
body: <p>How can I add <code>http://</code> to a URL if it doesn't already include a protocol (e.g. <code>http://</code>, <code>https://</code> or <code>ftp://</code>)?</p>
  <p>Example:</p>
  <pre><code>addhttp(&quot;google.com&quot;); // http://google.com
  addhttp(&quot;www.google.com&quot;); // http://www.google.com
  addhttp(&quot;google.com&quot;); // http://google.com
  addhttp(&quot;ftp://google.com&quot;); // ftp://google.com
  addhttp(&quot;https://google.com&quot;); // https://google.com
  addhttp(&quot;http://google.com&quot;); // http://google.com
  addhttp(&quot;rubbish&quot;); // http://rubbish
  </code></pre>