Michael said:
On 30/05/2005 10:41, Random wrote:
Unless the server has been configured differently, they
should always be named with a .js extension otherwise the
correct content type will not be sent.
A server cannot be configured to send JS files with the correct content
type as there is no correct content type for JS. They may be configured
to send JS with an incorrect content type (text/css would be incorrect)
but my experiments, outputting incorrect content types with dynamically
generated JS, suggest that web browsers consistently disregard the
content-type headers sent with JS files, which is reasonable given that
there is no correct content type. (I think that Netscape 2 was the only
browser that had an attitude towards JS content type, and it wanted and
application-x version).
I suspect that character encoding is all the browser will be interested
in when it comes to imported JS files, and whatever shows up will be
passed to the JS interpreter to syntax-error or not (assuming HTTP
status 200). Hence the reoccurring problems with servers sending custom
HTML 404 pages with HTTP 200 statuses making it look like JS is not
working when it is in fact not being found.
Richard.