I'm trying to find the url for the currently executing javascript. I know I can use window.location.href
for the current page, but that's not necessarily the path to the script which is executing.
Any help is greatly appreciated.
Thanks.
EDIT 1: I'm fully open to the use of plugins and such to accomplish this. Don't hesitate to suggest anything.
EDIT 2: I need this so that I can find a relative path from where my currently executing script is at to another resource. The issue is that, for example, the script is running at /js/myScript.js and the resource I need to reference is at /imgs/test.png. Since the .js file can be included from anywhere, the path to the .png file cannot be known.