What is the least loaded method when using jquery?

Asked 2 years ago, Updated 2 years ago, 40 views

1. Save directly to directory and declare
<script src="/dir/jquery-1.10.2.js"></script>

2. Declaring http path calls
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>

Before you use it like this, you declare a script, right? What is the best way to reduce network load for users? What's the best way to make mobile users feel the least pressure?

javascript jquery html css

2022-09-22 19:30

3 Answers

To reduce network load at the same time as having to use jquery... You can inline the contents of the jquery file itself on the page.

CDN starting with code.jquery~ is not recommended for use considering rtt because you don't know if there will be a server overseas or when and how it will change.

It's best not to use it as described above, but in reality, I wonder if there are jquery modules and large-scale web services that require performance that are hard enough to give up cross-browsing and ease of use (i.e. productivity).

If you're a mobile page and you need to respond to physical constraints, or if you're aiming to minimize data usage, or Unless quick page landing is directly related to profits, such as e-commerce (payment, shopping), jquery is not used, so you won't know even if you put it in by mistake. Haha


2022-09-22 19:30

The best way is not to use jquery.


2022-09-22 19:30

The question itself is a little wrong.

It is a static resource anyway, so the load is the same. I think it's right to ask where the network speed (download) would be faster to put static resources.

Of course, it's the fastest way to put it in the CDN. Required if the service is a global target.

In the cloud, cns services (aws' cloudfront) are provided by default, so it is recommended that you actively utilize them.


2022-09-22 19:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.