JavaScript - How do I get the URL of script being called?
<p>So, let's say I have this in the file <a href="http://site1.com/index.html">http://site1.com/index.html</a>:</p>

<pre><code>&lt;script src=http://site2.com/myscript.js&gt;&lt;/script&gt;
</code></pre>

<p>Inside "myscript.js", I need to get access to the URL "http://site2.com/myscript.js".  I'd like to have something like this:</p>

<pre><code>function getScriptURL() {
    // something here
    return s
}

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

<p>Which would alert "http://site2.com/myscript.js" if called from the index.html mentioned above.</p>

<p>I need this because the same script is going to be all over the place, and I don't want to have to hard-code its location into each one.</p>

<p>Thanks!         </p>
