Testing URL equivalence in JavaScript/JQuery (obtaining canonical form of URL)
<p>The same URL can be represented in many different representations.<br>
e.g. Assuming the browser's currently loaded page is<code>http://www.example.com/about.html</code></p>

<p>The following URLs can be considered equivalent from the browser's point of view:</p>

<ul>
<li><code>http://www.example.com/contact-us.html</code> and <code>http://www.example.com/contact-us.html</code></li>
<li><code>http://www.example.com/contact-us.html</code> and <code>contact-us.html</code></li>
<li><code>http://www.example.com/contact-us.html</code> and <code>.</code></li>
<li><code>http://www.example.com/contact-us.html</code> and <code>/contact-us.html</code></li>
</ul>

<p>With this in mind, is there an easy way to determine this equivalence using JavaScript?</p>

<p>Or, is there a way of obtaining a canonical form of a URL such that the canonical forms can be compared as a way of reaching the answer?</p>
