CDN loading script links look are generated into the page as follows:
<head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> if (typeof (jQuery) == 'undefined') document.write(unescape("%3Cscript src='/WestWindWebToolkitWeb/wwSC.axd?r=Westwind.Web.Controls.Resources.jquery.js' type='text/javascript'%3E%3C/script%3E")); </script> ... </head>
Note that the generated HTML includes a local fallback URL that uses a WebResource (for jQuery.js) and a local fallback Url (for jQueryUi) to allow for no internet connection. Header injection requires a <head runat="server"> attribute in order to work.
Enabling CDN Loading
You can control whether CDN loading occurs and where these libraries load from with code in your Application_Start or other 'startup' handler for your Web application. These properties are static so typically they only need to be set once on startup:
// Force jQuery to be loaded off Google Content Network ControlResources.jQueryLoadMode = JQueryLoadModes.ContentDeliveryNetwork; // override jquery urls explicitly - you can specify any URL: MS CDN, your own servers etc. //ControlResources.jQueryCdnUrl = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"; //ControlResources.jQueryCdnUiUrl = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"; //ControlResources.jQueryUiLocalFallbackUrl = "~/scripts/jquery-ui.min.js";
Once the above setting has been made all requests to load jQuery, jQuery UI via any of the code based mechanisms will be made using Content Delivery Network.