How to get the URL without any parameters in JavaScript?
<p>If I use:</p>

<pre><code>alert(window.location.href);
</code></pre>

<p>I get everything including query strings. Is there a way to just get the main url part, for example:</p>

<pre><code>http://mysite.com/somedir/somefile/
</code></pre>

<p>instead of </p>

<pre><code>http://mysite.com/somedir/somefile/?foo=bar&amp;loo=goo
</code></pre>
