Search code examples
javascriptabsolute-pathsrc

getting the path of a javascript file


In a javascript file (e.g. script.js) I need a variable that contains the absolute path to this file.

How can I do this dynamically?

Thanks.


Solution

  • The answer to this question (genius, didn't know this was possible at all!) should yield the full URL to the file. This will work only when the script is included traditionally using a script tag, though.