两个Google JS客户端CDN的区别是什么? [英] What is the difference between the two Google JS client CDN's?

查看:109
本文介绍了两个Google JS客户端CDN的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

唯一的区别是client.js之前的api:.

CDN A 用于网站的Google登录

CDN A is used in the Google Sign-In for Websites docs in the Building a button with a custom graphic section.

CDN B 几乎用于Google JavaScript的API客户端库(测试版)

CDN B is used almost in the Google API Client Library for JavaScript (Beta) docs.

它们似乎可以互换工作.

They both appear to work interchangeably.

推荐答案

简短答案:没有区别

长答案:

Google JS客户端CDN有点奇怪,因为您所获得的实际JS是根据您提供的文件名动态创建的. 您可以通过将URL构造为module1:module2:module3.js

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是核心部分,即使不将其添加到模块列表中也总是加载,因为它可以处理其他模块的加载.

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.

理论上,您可以只包含api.js,然后通过调用gapi.load("module", callback)动态加载额外的模块,这恰恰是加载api:client.js或仅加载client.js

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

例如,如果您想将API客户端库与新的登录方法一起使用,则可以包含api:client:auth2.jsclient:auth2.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.

为了引起更多的混乱,您甚至可以加入与https://apis.google.com/js/api.js相同的https://apis.google.com/js/.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

这篇关于两个Google JS客户端CDN的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆