When we click one <a>
tag the browser gets redirected to the corresponding page, but there are some details. Consider the following examples:
<a href="../onepage.html">One Page</a>
<a href="http://example.com/onepage.html">One Page</a>
<a href="onepage">One Page</a>
<a href="onepage.html">One Page</a>
When we visit such page with a browser it will in some sense translate those. If the address of the page on which this is located is http://www.example.com/pages/somepage.html
the first will be translated to a redirect to http://www.example.com/onepage.html
, the second will stay as it is, the third will be translated to a redirect into http://www.example.com/onepage
and the last one will also be like the third.
My question is: how can, using jQuery, we get those "translated versions" of the URLs? This is not the href
since this will give the information "as is".
How can we get with jQuery the URL a browser will actually follow if one clicks the link?