Home > Web Front-end > JS Tutorial > Does jquery need to be downloaded?

Does jquery need to be downloaded?

藏色散人
Release: 2022-12-30 11:13:24
Original
2944 people have browsed it

jquery does not need to be downloaded and can be directly imported into online jquery; and when users do not want to download and store jquery, they can also reference jquery through the CDN content distribution network.

Does jquery need to be downloaded?

The operating environment of this article: windows7 system, jquery1.2.6 version, Dell G3 computer.

Does jquery need to be downloaded?

Using jquery, you can directly introduce online jquery without downloading the jquery file.

If you don't want to download and store jQuery, you can also reference it through a CDN (Content Delivery Network).

Both Google and Microsoft servers store jQuery.

To reference jQuery from Google or Microsoft, please use one of the following codes:

Google CDN:

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
</script>
</head>
Microsoft CDN:
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js">
</script>
</head>
Copy after login

Reason for using a cdn

  • When the browser downloads CSS, js, images and other files from the server, it must connect to the server. Most servers have limited bandwidth. If the limit is exceeded, the web page will not be able to respond for a long time. CDN can load files through different domain names, thus greatly increasing the number of concurrent connections for downloading files.

  • Library files such as jquery are widely used. If the browser of the user who visits your website has already loaded jquery through the same CDN as yours when visiting other websites, because The file has been cached, so there is no need to download it again.

  • CDN has better availability, lower network delay and packet loss rate.

  • CDN can provide a local data center, so that users who are far away from your website's main server can download files nearby and quickly.

  • Many commercial paid CDNs can provide usage reports, which can be used as a supplement to your own website analysis reports.

  • CDN can distribute load, save bandwidth, improve the performance of your website, and reduce the cost of website hosting, usually for free.

When users visit their own sites, files are loaded from the server. Each server can only download 2-4 files at the same time, which will reduce the execution efficiency of the file. If you use more Server, the number of files loaded at the same time is (2-4) * number of servers, so we put jQuery on the CDN to improve the efficiency of loading files on the website.

Recommended: "jquery video tutorial"

The above is the detailed content of Does jquery need to be downloaded?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template