The author is Weitong Lin.
With pages include more and more Ajax functionalities,
We may need to include multiple JavaScript files. This may effect the page
Performance.
Here are two utilities that can help us load page faster.
1. Compress JavaScript files:
You can refer to Yui compressor for. Net (http://yuicompressor.codeplex.com/Wiki/View.aspx? Title = home)
It can compress both JavaScript and CSS. Really cool!
2. Combine multiple files
Are you using Ajax-Toolkit 3.5 in your project? If yes,
Please go to "B ".
A. Please get a brief idea of how to combine
Javascript/CSS files by http://www.codeproject.com/KB/aspnet/HttpCombine.aspx.
That's easy to follow the post to import this functionality
To your project.
But it needs to modify ate the JavaScript files reference
By WEB. config which is a little inconvenient.
So for our project, I created a customer control and
Update the scripthandler(compress-and-combine-js-css.rar), then we can add JavaScript reference
Below:
< C0: scriptregistercontrol ID = "Scriptregistercontrol1" Runat = "Server" >
< Scriptitems >
< C0: scriptitem Path = "Script/framework/jquery/jquery-1.2.6.js" />
< C0: scriptitem Path = "Script/framework/jquery. layout. js" />
< C0: scriptitem Path = "Script/framework/jquery/UI. Core. js" />
< C0: scriptitem Path = "Jswebconfig. js" />
< C0: scriptitem Path = "Script/framework/jquery/query-1.2-stringObject.js" />
</ Scriptitems >
</C0: scriptregistercontrol>
Then the script will render as one script:
B. if you already include Ajax-Toolkit 3.5 in
Your project, then use the similar functionality that provided
Scriptmanager.
< ASP: scriptmanager ID = "Scriptmanager1" Runat = "Server" >
< Compositescript >
< Scripts >
< ASP: scriptreference Path = "~ /Script/framework/jquery/json2.js" />
</ Scripts >
</ Compositescript >
</ ASP: scriptmanager >
Hope it can benefit for your projects.