Possible Duplicate:
How might I get the script filename from within that script?
JavaScript - How do I get the URL of script being called?
How, within my javascript code, can I determine the URL the javascript was loaded from, e.g. if I have a page http://www.example.com/index.html
<html>
<script src='/code/whereami.js'></script>
...
Then my javascipt would be loaded from http://www.example.com/code/whereami.js but how do find this URL from within the code?
(yes, by definition, as the programmer, I should know where my files are - the point of the exercise here is to verify the integrity of the resulting page)