Retrieving JavaScript source file location?
<p>If I load a JavaScript source file like so:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;script src="src/file.js"&gt;&lt;/source&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>My question is that how could <code>file.js</code> know that the relative path to its location is <code>src/</code>? I need this information for building up a URL from the source file that depends on the URL it was loaded from.</p>
