Fix for uncompressed JS files on IIS
Rule #1 in website optimization is to enable GZip compression on the web server. This is very easy using web.config as explained here. However, some web servers have disabled automatic compression of JavaScript files, because they are served with the content type: application/x-javascript.
For these web servers we can use a web.config trick to change the content type of JavaScript files to text/javascript. This is a completely valid content type supported by all browsers.
Just paste the following XML snippet in to your web.config’s <system.webServer> section.
<staticContent>
<remove fileExtension=".js"/>
<mimeMap fileExtension=".js" mimeType="text/javascript" />
</staticContent>
Chances are that you don’t have this issue, since it seems to only apply to some hosters, but now you know how to get around it should you ever end up in the situation with uncompressed JavaScript files.
Comments
Thanks for sharing ....... <a href="http://www.indiawebdesigncompany.in/">Website Design Company in Bangalore</a>
Internet marketingThank you for publishing this information. This post is amazing. http://www.bangalorewebdesigncompany.in/services.html
Internet marketingI never ended up in the situation with uncompressed JavaScript files. But thanks for sharing this trick. http://www.anthom-services.com
Anthomthanks for this men, I am a big follower of you regarding asp.net, and finally I got your blog and it solves my problem.
website marketing companyComments are closed