How to determine a script's location from the script's code?
<p>In struggling with a solution to <a href="http://stackoverflow.com/questions/8234215/where-are-scripts-loaded-after-an-ajax-call">this problem</a> I've run into another, related issue: how can I determine what the location of a running script is? (no, it's not <code>document.location</code> as that will tell you the location of the page including the script)</p>

<p>so, with:</p>

<p><strong>- a.html -</strong></p>

<pre><code>&lt;script type="text/javascript" src="/my/path/myscript.js"&gt;&lt;/script&gt;
</code></pre>

<p><strong>- myscript.js -</strong></p>

<pre><code>var myLoc = document.location; // what to use instead?
</code></pre>
