Can code in a Javascript file know its own domain/URL
<p>If I have a site, example.com, and a page on that site references a Javascript at subdomain.example.com/serveAd.js -- is there a way from within serveAd.js to know its own URL, or the domain from which it was downloaded?</p>

<p>(The JS can certainly know all about the page that called it. I want to know if the JS knows about its own origin.)</p>
