Should I use Google JSAPI in production code?

Possible duplicate:

should-i-link-to-google-apis-cloud-for-js-libraries

also many other discussions, including:

Where do you include the jQuery library? Google JSAPI? Cdn? The best way to use hosted jQuery Google, but failing to return to my hosted library on Google




I looked at the Tiny MCE plugin example and saw this code in the head document:

 <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.3"); </script> 

I have never seen this jQuery download method.

  • Is it recommended for production?
  • What is the advantage of this method?
+16
jquery html jsapi
Jul 09 '09 at 22:23
source share
8 answers

Yes, definitely. Google encourages him . Everyone wins. This will most likely be in their cache, and this is another file that you should serve.

+24
Jul 09 '09 at 22:31
source share

As others pointed out, answering such questions, there is a drawback. In some countries (for example, Iran) they seem to be blocked, violating the website.

+17
Jul 09 '09 at 22:49
source share

The advantage is that it is hosted on ultra-light latency and fast googles servers. you can also just use

 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 

its same effect.

+15
Jul 09 '09 at 22:31
source share

Keep in mind that google jsapi only downloads scripts after loading the document itself.

So, if (for example) you use jquery $(document).ready() in your web application, you need to go to google.setOnLoadCallback() .

+12
Jun 07 '10 at 15:23
source share

I believe Google’s JSAPI is also asynchronous and helps to avoid the “toll booth,” which is best described in “Imagine a 4-lane highway between your web browser and the Internet itself. This track is optimized for photos, text, and css fly. But when it comes to external scenarios, the highway creates a paid booth that slows down. The worst part is that the text of the images and the css caught behind these scenarios must wait until they pass "- Andres Vidal

The booth is critical and must be avoided at all times.

+5
Dec 08 '09 at 22:38
source share

I think this method will help you for the following reasons:

Google uses a content delivery network that will force users who are far from your location to load your jquery libraries faster than if they did from your site.

It will also reduce the request to your server and force users to download jquery javascript from the google server for the first time, and if the user is on another similar site with such an implementation, he will not need to download it again,

So, I think this will help you application / site

+3
Jul 09 '09 at 22:33
source share

this file after compression is 24 KB, adding such a file will increase HTTP requests and wait for a response and execution and parsing time that the browser will take ... if you say that the file itself is cached everywhere, even if the file is cached in the browser, not forget to consider the time it takes to read from disk, execute and parse ...

all this to get only a jQuery file or other common JS, I think it's better to refer to the requested resource

Check out Google best practices for more information.

+1
Dec 03
source share

In China, there are 500 million Internet users and not the only country that blocks google apis, any website that uses http://www.google.com/jsapi dysfunctional makes it. There is little potential for growth: due to the asynchronous loading technique, these sites do not display the same hovering pending load as other sites that use a direct link, for example:

+1
Sep 30 '15 at 23:32
source share



All Articles