title: Converting relative paths to absolute with JavaScript
body: <p>HTML:</p>
  
  <pre><code>&lt;a href="/"&gt;1&lt;/a&gt; // link to http://site.com
  &lt;a href="/section/page/"&gt;2/a&gt; // link to http://site.com/section/page/
  &lt;a href="http://site.com/"&gt;3&lt;/a&gt;
  &lt;a href="../gallery/1/"&gt;4&lt;/a&gt; // link to http://site.com/gallery/1/
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$("a").live('click', function(){
      var url = $(this).attr("href");
      //do something
  });
  </code></pre>
  
  <p>How to convert relative path (<code>var url</code>) to absolute by jQuery?</p>
  
  <p>Script should do nothing, if it is already an absolute path.</p>
  
  <p>Thanks.</p>