title: Get full URL from a hyperlink using jQuery / JavaScript
body: <p>How can I retrieve the full URL to which an anchor links using jQuery / JavaScript consistently across all browsers? For example, I want to return <code>http://www.mysite.com/mypage.aspx</code> from <code>&lt;a href="../mypage.aspx"&gt;&lt;/a&gt;</code>.</p>
  
  <p>I have tried the following:</p>
  
  <ol>
  <li><p><code>$(this).attr('href')</code>: The problem is that jQuery returns the exact value of the href (i.e., <code>../mypage.aspx</code>).</p></li>
  <li><p><code>this.getAttribute('href')</code>: This works in Internet Explorer, but in FireFox it behaves the same as above.</p></li>
  </ol>
  
  <p>What is the alternative? I cannot simply append the current site's path to the href value because that would not work in the above case in which the value of the href escapes the current directory.</p>