Okay, I've been searching for this for way too long already... I'm trying to find out how I can return the filename of the page that's running an included javascript, from inside that javascript.
I can easily do this in PHP using $_SERVER['SCRIPT_FILENAME'], but in Javascript this seems to be a lot harder.
Do I really need to substring it from location.href or is there a more efficient way? Could jQuery help?
location.hrefsolution assumes that your filename is exposed in the URL. It won't work if your URL are rewritten -- see this question's URL.