Can anyone help me find the URL of the JavaScript currently being executed? I am aware of using window.location.href
for the current page, but that doesn't necessarily provide the path to the script that is running.
Any assistance would be greatly appreciated.
Thank you.
EDIT 1: I am open to utilizing plugins or other methods to achieve this. Please feel free to suggest any solutions.
EDIT 2: I need to determine the relative path from my executing script to another resource. The challenge arises when the script is located at /js/myScript.js and the resource I need to reference is at /imgs/test.png. Due to the script being included from various locations, the path to the .png file remains unknown.