How do I parse the web browser address using javascript and window.location?
<p>I'm finding it impossible to search for a particular value within the Address Bar. </p>

<pre><code>var str = window.location;
//var str = "http://www.website.com/78203/";

var x = str.search(/78203/i);

alert(x);
</code></pre>

<p>The above code returns nothing, and in fact kills the running of anything else (indicating an error) but nothing is thrown in the console.</p>

<p>If you remove the comment, it runs fine, returning a value of more than -1 (meaning it's found something).</p>

<p>This is obviously something I'm not understanding correctly, can someone help me out?</p>
