Recently, many websites that reference jquery files use Google libraries. scripttype "text/javascript" src "libraries such
Recently, many websites that reference jquery files use Google libraries. Script
Loading jquery like above uses Google's CDN-Content DeliveryNetwork to load jquery library files on your website. Some may ask why Google's jquery library file should be loaded? (PS: Do I usually load jquery library files on my server ?). Haha ~~ I thought the same thing before, and I have always loaded my own
The jquery file on the server.
Let me talk about the advantages of using Google to load jquery library files.
1. Increase the Simultaneous loading speed of webpages
To avoid service overload, the browser limits the number of simultaneous connections. Depending on different browsers, this limit may be limited to only two of each data center.
Use Google's AJAX content service network to respond to your website, so that more services can be performed on your local server at the same time.
2. Reduce the waiting time
Everyone should be similar. They are feeling the strength of jquery and the strength of jquery's team ~ Now the latest jquery version is 1.7.1, but it is quite unpleasant.
Even the compressed mini code is 83.2KB. But I don't know if you have read it on the official homepage.
CDN-Content DeliveryNetwork (Content Delivery Network) refers to the distribution of some of your static Content through various service channels. When the user's browser submits these files
They will automatically download the most recent available files on the network.
For this reason, any user using your service downloads the JQuery library from Google faster than downloading it from your own server. In fact, there are a lot of CDN services that can be compared with Google's
But it is difficult for them to surpass Google's free service advantages. This benefit is enough to determine the problem, but this is only part of it.
3. Better caching
The biggest benefit of using the Google AJAX library content publishing service is that your users do not need to download jQuery at all. No matter how powerful your cache is, if you use your own server to provide jQuery, then you
Users must download it at least once. A user may download many identical jQuery files in the cache area of their browser. min. js to copy the version, but when they access your network for the first time
The copied versions are ignored.
On the other hand, when the browser detects a link to Google in the same version, it will know that this is the download of the same file, not only will Google's server return a 304 (no file modification instruction is required
(That is, the file on the server has not been changed) to reply to a duplicate request, and will command the browser to cache the file for up to one year.
This means that even if some people access hundreds of jQuery websites using Google services, they only need to download them once.
However, it seems that the last day has been a little disgusted with Google's things. Just like Google's departure from Hong Kong in the past, Sometimes Google's things cannot be opened, so will it be loaded one day?
Will jquery library files also fail? Haha ~~ Everything is possible ~ It doesn't matter. Here there are 10 thousand full methods: