See if current page equals relative link - JavaScript
<p><em>I know that different versions of this question has been asked in the past, although this exact question has not been asked (and none of the other answers suit my purposes);</em> </p>

<p><strong>So, here goes</strong>: I have a relative link in JavaScript (which is stored as a string) and I am trying to see if that string equals the current URL for the page I'm on </p>

<p>(<em>for example</em> if the JS link is <code>"/test"</code> and the url is <code>http://example.com/test</code> the function should return true, whereas if the string is <code>"/test"</code> and the current url is <code>http://example.com/derp</code> the function should return false).</p>

<p><strong>Lastly:</strong></p>

<ul>
<li>Hash tags in the URL should be ignored</li>
<li>Get variables should also be ignored</li>
</ul>

<p>I am looking for a function in JavaScript (or jQuery) that does this -or something that does something that gets me closer to doing this (I have to assume there is one, simply because this language (+ this framework) has so many methods for handling the URL); if there isn't one <em>can someone point me to a jQuery plugin that does this</em> or <em>show me a piece of custom written code</em> to do this (I <strong>can't</strong> be the first one to ask for this!)</p>
