[thelist] Where do I place my remote JS file?

Keith Davis cache at dowebs.com
Fri May 25 23:49:40 CDT 2001

sfmalo wrote:
> Recently, with a lot of good advice from the group here, I did a Javascript
> mouseOver/onClick script which I will now place in a remote.js file. My
> question is: in which directory do I place it? Do I place it both where the
> index.html file is AND the HTML directory is?
> The structure I have set up is the index.html file goes in the root
> directory and I have HTML and Images subdirectories.

Theoretically you can place them anywhere within your domain or even
some other domain. 

But, I assume this is your first shot at external js files on that
server. You need to make sure the server has the
application/x-javascript mime type so it will deliver the file. If it
isn't, or if it has restrictions you can lose time, spouse, and sanity
trying to figure out what's wrong. (not necessarily in that order)

Best to first place it in the root with index.html (assuming that the
script is called by index.html) and reference it with the full URL. If
that works then the mime is installed. Then you want to make sure that
the server has no restrictions. Try it with only the file name instead
of the URL. If that works then move it to any other directory and use a
relative path to reference it. If that works everything is OK. 

> Sure can't see the forest for the trees (again). 

Forest? What forest. There's legs on the worms in the apples in the
trees, but forest? is there a forest here??


More information about the thelist mailing list