So, let's say I have this in the file http://site1.com/index.html:
<script src=http://site2.com/myscript.js></script>
Inside "myscript.js", I need to get access to the URL "http://site2.com/myscript.js". I'd like to have something like this:
function getScriptURL() {
// something here
return s
}
alert(getScriptURL());
Which would alert "http://site2.com/myscript.js" if called from the index.html mentioned above.
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.
Thanks!