Download js files from the Internet or service them yourself?

I have had this question for a while, and am surprised that I have yet to find a good / complete answer to it.

The question is basically this: When it comes to downloading js files, in what situations should you download them from the Internet, if available, or service them yourself? When is minimal latency usually used?

eg.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

against.

<script src="js/jquery-1-11-3.min.js"></script>

+4
source share
2 answers

Full answer: Both.

Downloading this website will benefit you in several ways:

1) HTTP-, . . , google CSS/.

2) , , HTTP 304 not changed .

, , , . , , :

<script>
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='/js/jquery-2.0.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>

JQuery CDN, , jQuery undefined . CDN , .

+5

:

  • google , .

  • , Google , script .. ppl Google .

  • google . , connec , googles.

  • -

, . .

+1

All Articles