In struggling with a solution to this problem I've run into another, related issue: how can I determine what the location of a running script is? (no, it's not document.location
as that will tell you the location of the page including the script)
so, with:
- a.html -
<script type="text/javascript" src="/my/path/myscript.js"></script>
- myscript.js -
var myLoc = document.location; // what to use instead?