If I'm开发者_如何学运维 right, each request for http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js uses something like 3kb of microsoft.com cookies. Do I not understand something and it doesn't matter or is Microsoft wrong?
It's because there's a whole bunch of cookies set for the microsoft.com domain, which will naturally also be sent to requests to its subdomains as well. Microsoft is doing it wrong.
Google, on the other hand, uses a separate domain (googleapis.com) for its CDN, for which at least I have exactly zero cookies. I suggest you use Google's CDN instead.
You are right and Microsoft solved this eventually by creating ajax.aspnetcdn.com:
http://www.asp.net/ajaxlibrary/cdn.ashx#ajaxmicrosoftcom_renamed_to_ajaxaspnetcdncom_15
ajax.microsoft.com renamed to ajax.aspnetcdn.com
The CDN used to use the microsoft.com domain name and has been changed to use the aspnetcdn.com domain name. This change was made to increase performance because when a browser referenced the microsoft.com domain it would send any cookies from that domain across the wire with each request. By renaming to a domain name other than microsoft.com performance can be increased by as much to 25%. Note ajax.microsoft.com will continue to function but ajax.aspnetcdn.com is recommended.
Old Format: http://ajax.microsoft.com/ajax/jQuery/jquery-1.8.0.js New Format: http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js
精彩评论