Jump to content

Current Location of a JavaScript File


The Little Guy

Recommended Posts

You have to do something like this:

 

page where you are including script

<script id='something' type='text/javascript' src='script.js'></script>

 

inside your script

alert(document.getElementById('something').src);

 

Or retrieve the script src through other means (like get element by tag name or if you use jquery get it that way or w/e)...the point is that you have to get it by looking for the src of the script include.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.