Document directory
- What is Google's Js hosting?
- What are Google's advantages?
- What are the benefits of Google hosting?
- Is there a negative impact on hosting?
What is Google's Js hosting?
As we have done before, the referenced JS library is stored on the Google server.
For example, if jquery is referenced, use the path http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js.
That is, no matter who the website is, as long as you use it, it will get the same effect as referencing it on your own server.
Of course, this has its advantages. Otherwise, someone else will be charged for hosting.
What are Google's advantages?
Google has DNS servers all over the world, which has become a favorable condition for hosting.
For example, I bought a domain name space outside China and obtained resources from foreign servers through DNS when I visited Beijing. Maybe this server is very busy, so I will wait for a while to pay attention to it, the path for transferring resources on this server may be slow.
However, through Google's DNS server, we can allocate a recent and less busy server to provide me with a JS library hosted on it, which can increase the loading speed.
What are the benefits of Google hosting?
In addition to Google's DNS servers distributed all over the world, there is also a benefit of using Google hosting to effectively use the cache.
Back to the first question, I wrote another B .html file after reading a.html.
B .html references http://www.xxx.com/ B /jquery.js. These two jquery versions are the same.
So I found that the cache does not contain www.xxx.com/ B /jquery.js in mongob.html, which is a duplicate of the JS library.
But if both files use a http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js,
You only need to use the JS library cached in the browser when using javasa.html for example B .html. The benefits are obvious.
Is there a negative impact on hosting?
Of course, any good thing has a bad side. The so-called hosting requires a strong dependence on Google.
Once Google goes down, it is indeed a big headache. (But this should be impossible)
But at that time, I thought Google's servers would probably have been bought by some nostalgic people for sharing. I hope so.
Hosting is something someone else can do for you, just as you wish. Let's make your own decisions!
Bytes ---------------------------------------------------------------------------------------------------
Common Reference Methods:
<script type=text/javascript src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script>!window.jQuery && document.write('<script src="jquery.js"></script>');</script>
Note: Google-hosted jquery is referenced. If it fails, local jquery is used.
Common jquery version reference addresses:
1.2.6:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
1.3.2:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
1.4.2:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
1.5.2:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
1.6.2:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
1.6.4:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
1.7:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script>
1.7.1:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
1.7.2:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
1.8:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
Latest Version (last ):
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>