I have read many articles related to this question but I am still confused, so please could someone explain it to me?
Say we have two options to use jquery files:
- CDN
- Save in Local solution
Could someone explain to me which is best?
I have read many articles related to this question but I am still confused, so please could someone explain it to me?
Say we have two options to use jquery files:
Could someone explain to me which is best?
Answered at https://stackoverflow.com/a/2180401/537998
This is because:
- It increases the parallelism available.
(Most browsers will only download 3 or 4 files at a time from any given site.)- It increases the chance that there will be a cache-hit.
(As more sites follow this practice, more users already have the file ready.)- It ensures that the payload will be as small as possible.
(Google can pre-compress the file in a wide array of formats (like GZIP or DEFLATE). This makes the time-to-download very small, because it is super compressed and it isn't compressed on the fly.)- It reduces the amount of bandwidth used by your server.
(Google is basically offering free bandwidth.)- It ensures that the user will get a geographically close response.
(Google has servers all over the world, further decreasing the latency.)- (Optional) They will automatically keep your scripts up to date.
(If you like to "fly by the seat of your pants," you can always use the latest version of any script that they offer. These could fix security holes, but generally just break your stuff.)
If you refer CDNs, the JS files will be downloaded in your cache. If they were already in the cache then that time would be saved. But if the user clears the cache very frequently, then files would be downloaded.
If you use JS files stored in local, then there would be no need to download the js files.
Simple answer,in case of CDN your Script will work only if you are CONNECTED TO INTERNET.
So JS at local would be an ideal solution if you are not going to change location of the JS files again and again.