[Javascript] Callback to script-tag from included script?

Hakan Magnusson (Backbase) hakan at backbase.com
Wed Aug 18 11:12:45 CDT 2004


Hi Roger,

Thanks for the input, but document.location is no good. Because this 
script file can be included from anywhere in the site structure, it must 
be able to reference to its "own" location.

This also has to be unique for every HTML-file that includes the file, 
so fixing on a global variable for the (absolute) path, like sMyPath = 
'/blah/js/external.js', is no good either.

If the page is in 'blah/' I need to have 'js/external.js' as the data, 
and if the page is in 'blah/bluh/' I need to have '../js/external.js' as 
the data.

Wicked, eh? :)

Regards,
H



More information about the Javascript mailing list