Besides fixing some bugs and adding some new features to the existing controls, the new release of the AJAX Toolkit introduces the ToolkitScriptManager control. This new control lets you combine several embedded scripts on a single download, which might improve the performance of your page in some scenarios.
Its usage is simple: you add the ScriptCombineAttribute attribute to the assembly that contains the JS files you want to be combined and add a ToolkitScriptManager control to the page (making sure that the CombineScripts property of the control is set to true – which is the default).
When you apply the attribute to an assembly, all the scripts embedded on the dll that are need for a specific page will be combined in a single download. You can also specify which files should and shouldn”t be combined by setting the ExcludeScripts and IncludeScripts properties (as you can guess by their names, the IncludeScripts property lets you specify which scripts should be combined or excluded from the single download file that is generated by the control).
Another difference when you think about loading js files: you no longer need to call the Sys.Application.notifyScriptLoaded method at the end of the js files that are combined into a single download.The control automatically calls that method for you, so there”s nothing to worry about.
To me, the control”s greatest advantage is that you”ll automatically get a single download which is compressed (using the GZIP or Deflate algorithm) and cached by the browser. The internal implementation of the control is also interesting. The control inserts a script element whose generated url points to the current page and uses a query parameter (named _scriptcombiner_) to specify the list of scripts that should be combined into a single one. During the Init event, the control checks the value of that query string parameter. If it”s not null, it”ll generate a custom response that inserts the requested js files on the page and end the current request.