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.
views:
32answers:
4
+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
2010-07-26 19:41:30
+1
A:
It's not required. I see plenty of ".php" files that are the source of script tags.
Robusto
2010-07-26 19:46:52
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
2010-07-26 19:50:47
The official MIME type is *application/javascript*. But *text/application* should be used due to compatibility issued.
Gumbo
2010-07-26 19:54:06
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
2010-07-26 19:52:18