.js (File extension)

JavaScript include file.

You can include external shared fragments of JavaScript into a web page by calling in a .js file.

A .js file simply contains that JavaScript which would have been placed inside a <SCRIPT> tag.

In the case of the Netscape browser, it can store configuration and preferences data in .js files.

These .js files can also be used server-side with Netscape Enterprise Server. They can be compiled with the LiveWire JavaScript compiler and linked with the HTML to create .web files that Netscape Enterprise Server can deliver very quickly to a requesting client browser.

The MIME type for a .js file used to be application/x-javascript but is now text/javascript. Either should work but text/javascript is preferred. This may necessitate you carrying out some server configuration changes if you don't already serve this kind of file.

The file is included by specifying its URL with the SRC="..." HTML tag attribute. You must also include a closing </SCRIPT> tag because <SCRIPT> is a block level item.

Example code:

   <SCRIPT SRC="http://www.mydomain.com/include.js">

See also:<SCRIPT ARCHIVE="...">, <SCRIPT SRC="...">, File extensions, Preferences, Source files, Web browser


O'Reilly JavaScript Definitive Guide - page - 215

Wrox Instant JavaScript - page - 3