As per Yahoo's guidelines for performance of web sites , javascripts should be combined in one to avoid extra http request , as i saw in YSlo开发者_如何学编程w asp.net loads 3 to 4 scripts one for MicrosoftAjax.js , one for microsoft MicrosoftAjaxForms.js & some other 2 which may tondle postbacks & client side validations , I want these 4 js to be in one.
there are 4
Please tell me how to do i achieve this ?
Thanks .
You might want to take a look at the ScriptManager - CompositeScript feature...
http://msdn.microsoft.com/en-us/library/cc488552.aspx
which can be used like this:
<asp:ScriptManager runat=”server” ID=”ScriptManager1”>
<CompositeScript>
<Scripts>
<asp:ScriptReference Name=”MicrosoftAjax.js” />
<asp:ScriptReference Name=”MicrosoftAjaxWebForms.js” />
</Scripts>
</CompositeScript>
Note that this is an ASP.NET 3.5 feature.. so if you are using at least 3.5, you will have access to this..
I recommend you read this article which talks about the same thing you've asked.
http://www.codeproject.com/KB/aspnet/fastload.aspx
精彩评论