check if user is visiting pure root url
<p>I'd like to run a js script if a user is visiting my site's root url. I am using this code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    if(location.pathname == "/") {
        window.open ('#107','_self',false);
    }
&lt;/script&gt;
</code></pre>

<p>However <a href="http://example.com/?foo=bar#hash" rel="nofollow">http://example.com/?foo=bar#hash</a> will also run the script, since the pathname excludes the query string and location hash.</p>

<p>It currently behaves like this:</p>

<pre><code>http://example/                  Root
              /?querystring      Root
              /#hash             Root
              /page              Not root
</code></pre>

<p>I want it to behave like this:</p>

<pre><code>http://example/                  Root
              /?querystring      Not root
              /#hash             Not root
              /page              Not root
</code></pre>

<p>Any suggestions?
Thanks.</p>
