How can I get the full URL at which anchor links using jQuery / JavaScript appear sequentially in all browsers? For example, I want to return http://www.mysite.com/mypage.aspx from <a href="../mypage.aspx"></a> .
I tried the following:
$(this).attr('href') : The problem is that jQuery returns the exact value of href (i.e. ../mypage.aspx ).
this.getAttribute('href') : This works in Internet Explorer, but in FireFox it behaves the same as above.
Which alternative? I canโt just add the current site path to the href value, because this will not work in the above case, in which the href value is executed in the current directory.
source share