Using the Code
What I saw when I checked the network tab is displayed in the below image:
What do we have to do to get this implemented?
First, we have to specify the JS files to be compressed in the Web.config file as CSV instead of specifying each and every file separately.
Change the above type specifying the JS files in Pages to web.Config file as below:
We have to call the Handler from the page in which we would like to use the JS file mostly in Master pages as shown below:
The Handler will read the JS files, then compress them using
GZipStream and send back to the client browser. See the below image which is the result of compression.
You can see only one call to the
HttpCombiner handler .. that is the request which combines all the files and sends back to the client browser. If you compare the loading time and size of the file, it might be 1/4 of the exact.
I suggest using this mechanism to those who are using JS and CSS files extensively. To implement this, I have also done a Google search and found the handler doing the compression. I have tried to show the power of GZIP compression what I got during testing and I found this very helpful.
I am also attaching a link to the handler which I used to implement this mechanism. You can also use this same Handler to implement this by doing the above mentioned modifications.
And a big thanks to the guy who wrote this Handler.