Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set my JS MIME type to "text/javascript"

According to this: Javascript MIME Type, it seems that I should be serving my JS as "text/javascript". When I inspect the network communication between my browser and localhost (or my server), the MIME type of the JS that are hosted on my web server is application/x-javascript. The JS from Google CDN (e.g. jQuery) is text/javascript.

I want to make my JS become text/javascript. In my .htaccess, I tried adding this: AddType text/javascript .js, but it didn't change my MIME type.

Suggestions?

like image 713
StackOverflowNewbie Avatar asked Oct 17 '12 13:10

StackOverflowNewbie


1 Answers

you need to change your settings in mimes.types file found in your apache conf folder. Change

application/javascript          js

to

text/javascript                 js

and restart apache, you should see the change

like image 194
WebChemist Avatar answered Oct 05 '22 14:10

WebChemist