is there a method in JavaScript by which I can find out the path/uri of the executing script.
For example:
-
index.htmlincludes a JavaScript filestuff.jsand sincestuff.jsfile depends on./commons.js, it wants to include it too in the page. Problem is thatstuff.jsonly knows the relative path of./commons.jsfrom itself and has no clue of full url/path. -
index.htmlincludesstuff.jsfile as<script src="http://example.net/js/stuff.js?key=value" />andstuff.jsfile wants to read the value ofkey. How to?
UPDATE: Is there any standard method to do this? Even in draft status? (Which I can figure out by answers, that answer is “no”. Thanks to all for answering).
This should give you the full path to the current script (might not work if loaded on request etc.)