title: Convert relative path to absolute using JavaScript
body: <p>There's a function, which gives me urls like:</p>
  
  <pre><code>./some.css
  ./extra/some.css
  ../../lib/slider/slider.css
  </code></pre>
  
  <p>It's always a relative path.</p>
  
  <p>Let's think we know current path of the page, like <code>http://site.com/stats/2012/</code>, not sure how do I convert these relative paths to real ones?</p>
  
  <p>We should get something like:</p>
  
  <pre><code>./some.css =&gt; http://site.com/stats/2012/some.css
  ./extra/some.css =&gt; http://site.com/stats/2012/extra/some.css
  ../../lib/slider/slider.css =&gt; http://site.com/lib/slider/slider.css
  </code></pre>
  
  <p>No jQuery, only vanilla javascript.</p>