JavaScript and .js file ending, Strict requirement for pages with links to external links?

Is a .js file a strict requirement for JavaScript link pages? I did not encounter problems with IE6,7,8 and FF3.5 when testing, but wanted to confirm. I have an architectural constraint that leads me to this question.

+3
source share
4 answers

I didn’t think so, but if this gives you problems, just add the query string ending in ".js" to your url ...

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

This is not required. I see many .php files that are script tag sources.

+1
source

, mime application/x-javascript, .

A quick test shows that Google Chrome will allow the wrong mime type, causing a warning to the console. Internet Explorer might be a little stricter.

0
source

You must specify the 'type' property of the 'script' tag or pass the Content-type: application / x-javascript header from the server. There is no limit to the file name.

0
source

Source: https://habr.com/ru/post/1756630/


All Articles