You are here: irt.org | FAQ | JavaScript | source | Q1121 [ previous next ]
Put your script in a file with extension .js
If your script looks like this before:
<script language="JavaScript"><!-- // test of .js files alert('js file loaded'); //--></script>
The file test.js looks like this (cut and paste what is between the script tags except the javascript cloak comments:
// test of .js files alert('js file loaded');
And the script tags now look like this:
<script src="test.js" language="JavaScript"></script>
Your server needs to have the mime type application/x-javascript set up for .js extensions. One server that doesn't have that as default is IIS3. The SRC attribute of the script tag is not supported by Netscape Navigator 2 and Internet Explorer 3.