tags:

views:

32

answers:

4

Is the .js file ending a strict requirement for externally referenced JavaScript pages? I have not run into issues with IE6,7,8 and FF3.5 in testing but wanted to confirm. I have an architecture limitation leading me to this question.

+1  A: 

I didn't think so, but if it's giving you problems just add a query string ending in ".js" to your url...

<script src="/scripts/myscript.weirdextension?dummy=myscript.js"></script>
no
+1  A: 

It's not required. I see plenty of ".php" files that are the source of script tags.

Robusto
A: 

Provided that the file outputs with a mime-type of application/x-javascript, there should be no problems.

A quick test shows that Google Chrome will allow for an incorrect mime-type, throwing a warning to the console. Maybe Internet Explorer is a little stricter.

Bauer
The official MIME type is *application/javascript*. But *text/application* should be used due to compatibility issued.
Gumbo
A: 

You must specify 'type' property of 'script' tag or pass 'Content-type: application/x-javascript' header from the server. There are no restriction for filename.

Riateche