What is the difference between the two Google JS client CDN's?

自作多情 提交于 2019-12-03 20:35:51

Short answer: there is no difference

Long answer:

The Google JS client CDN is a bit weird because the actual JS you get is dynamically created based on the file name you provide. You can load multiple components of the library by constructing the URL as module1:module2:module3.js

api is the core part and is always loaded even if you don't add it to the list of modules, because it handles loading the other modules.

Theoretically you could just include api.js and then dynamically load extra modules by calling gapi.load("module", callback) which is exactly what happens when you load api:client.js or just client.js

If for example you would want to use the API Client Library together with the new sign-in methods you could include api:client:auth2.js or client:auth2.js.

And for extra confusion you could even include https://apis.google.com/js/.js which is the same as https://apis.google.com/js/api.js

artamonovdev

Use links only from the documentation!

Simple to check this:

1) Add to header of your page this script:

<script src="https://apis.google.com/js/client.js"></script>

Open DevTools -> Network I see:

2) Change link to other script

<script src="https://apis.google.com/js/api.js"></script>

Open DevTools -> Network

I see:

api.js is the core, when client.js is the module.

Here a completely different content: https://apis.google.com/js/platform.js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!