Possible Duplicate:
How to get the location (src) of a javascript file?
I have a JavaScript that will be included on third party sites, using <script src="" >
. It will be potentially hosted on couple of different domains/hosts of mine. I need to get a domain name of the server that hosts the script, not the domain name of the server that included the script file. So if i host the script file on ABC.COM and it gets included from ZYX.COM i need to retrieve ABC.COM. I could hard-code the domain name inside the script but i rather keep a single version of my code.
Is there a way to do this from within JavaScript?