title: How to remove 'http://' from a URL in JavaScript
body: <p>I have run into an odd situation. I'm writing a JavaScript bookmarklet that will allow users to click and share external websites to our website very easily and quickly. It simply get's the title, page URL, and if they've selected any text on the page, it grabs it too.</p>
  
  <p>The problem is it doesn't work with external domains for some reason, so if we use it internally we end up with a share window with the URL formatted like this:</p>
  
  <p><a href="http://internaldomain.com/sharetool.php?shareid=http://internaldomain.com/anotheroddpage.html&amp;title=" rel="noreferrer">http://internaldomain.com/sharetool.php?shareid=http://internaldomain.com/anotheroddpage.html&amp;title=</a>....</p>
  
  <p>That works just fine, BUT if we try to use an external domain and end up with a URL formatted like this:</p>
  
  <p><a href="http://internaldomain.com/sharetool.php?shareid=http://externaldomain.com/coolpagetoshare.html&amp;title=" rel="noreferrer">http://internaldomain.com/sharetool.php?shareid=http://externaldomain.com/coolpagetoshare.html&amp;title=</a>...</p>
  
  <p>Then we get a <em>Forbidden Error</em> on our page and can't load it... If we manually remove the <code>http://</code> from the externaldomain address, it loads just fine again.</p>
  
  <p>So.. I'm thinking the best solution to get around this problem is to modify the JavaScript bookmarklet to remove the <code>http</code> as it's loading the window. Here is how my current bookmarklet looks:</p>
  
  <pre><code>javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://internaldomain.com/sharetool.php',l=d.location,e=encodeURIComponent,u=f+'?u='+e(l.href)+
  </code></pre>
  
  <p>As you can see, <code>e(l.href)</code> is where the URL is passed.</p>
  
  <p>How can I modify that so it removes the external domains <code>http://</code>?</p>