Why can I not do search on a window.location?
<p>I need to check if the location is similar to some text.  So my code is as below:</p>

<pre><code>        //are we already on the same form
        var loc = window.top.window.location;
        if(loc)
           window.alert("loc=" + loc);

        if(loc &amp;&amp; loc.search(form, "i") != -1)
        {

        }
</code></pre>

<p>The window.top.window looks a bit odd - it is used because the window might not be the topmost and I need to get the topmost instance.</p>

<p>I do get an instance of loc - so it is not null.  But the search works?</p>

<p>But if I run this code I get a javascript runtime error:</p>

<pre><code>Caught exception: Object doesn't support this action
</code></pre>

<p>Why do I get this problem?</p>

<p>If I cannot search how can I compare strings using a location?</p>

<p>EDIT</p>

<p>What confused me is that location does have a read-only property search which is the HTTP GET command.  </p>

<p>I was thinking I was doing .search on a string - but instead was attempting to write to a read-only property.</p>
