Search
DotNetNuke (DNN) Resource Search
Only DNN - DotNetNuke Blog
FeedBurner Subscribe to Ismet Dumlupinar's DotNetNuke Blog
16
How to Compress Javascript with IIS 7



I was testing something with IIS 7, by default IIS 7 compression module is way different and easier than the one presented within IIS 6.

My goal was compressing javascript files with IIS7. However, my story was kinda weird. First, i had to check default collection of ApplicationHost.config file and noticed that mime type configuration presented'ike below.

  • text/javascript
  • application/x-javascript
  • application/javascript

Although text/javascript was coming first, i had trouble with IIS7 to compress javascript files. Then after examining ApplicationHost.config file below:

<httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="0">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>

<mimeMap fileExtension=".jpg" mimeType="image/jpeg" />
<mimeMap fileExtension=".js" mimeType="application/x-javascript" />
<mimeMap fileExtension=".jsx" mimeType="text/jscript" /

I had to modify web.config for text/javascript to be default selection for mime type for js files.
<system.webServer>
<staticContent>
<remove fileExtension=".js" />
<mimeMap fileExtension=".js" mimeType="text/javascript" />
</staticContent>
</system.webServer>
Posted in: Tips

Post Rating

Post Comment

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above:




Web Hosting Blogs - BlogCatalog Blog Directory

blogarama - the blog directory


Web Development blogs & blog posts

2008 - 2010 www.onlydnn.com   |  Privacy Statement  |  Terms Of Use  Xhtml 1.0  CSS 2.0