How to prevent one specific javascript from running on one page?
<p>I have a whole bunch of head javascripts, all in one file. One of the scripts checks if the visitor has already selected a layout format (normal, tablet, mobile). If not, s/he is alerted that there is such a choice, to be made on the index page. </p>

<p>But as that option is the first thing that is described on the index page, it is not necessary for that script to run if the index page itself is requested. But how do I prevent that specific script from running on only the index page? I tried this</p>

<pre><code>function informVisitor() {
    var layout = readCookie("layout");
    if (((layout == "") || (layout == null)) &amp;&amp; (window.location.indexOf("index.php") != 0))
    {alert('Are you using a small device?\n Check the Welcome page for layout options.')}
}
informVisitor();
</code></pre>

<p>but Firebug says that <code>window.location.indexOf</code> is not a function. Is it possible, and if so, how? Or should I just use <code>window.location</code> with the whole http-url and forget about the local story? </p>
