Getting URL of executing JavaScript file (IE6-7 problem mostly)...

Posted by TooTallNate on Stack Overflow See other posts from Stack Overflow or by TooTallNate
Published on 2010-06-10T22:50:59Z Indexed on 2010/06/10 22:52 UTC
Read the original article Hit count: 128

Hey all, I've been trying to throw together a generic function that retrieves the absolute URL of an executing JavaScript file on a web page:

http://gist.github.com/433486

It works great in almost all the browsers I've tested (Firefox, Chrome, Safari, Opera v10 at least, and IE 8). It seems to fail, however, in IE 6 and 7. The callback function gets executed, but the retrieved name is simple the URL to the main HTML page, not the JavaScript file.

So all I'm really asking is if there's some other way of getting the URL of the current JavaScript file (which could be IE 6 and 7 specific)? Thanks in advance!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html