javascript - platform.js 还是 api.js?谷歌API

标签 javascript web-applications google-api google-api-js-client

试图了解我应该如何为静态页面网络应用程序引用 google api。我很困惑。

  1. 我不确定完整的文档在哪里,因为我已经在这个存储库中偶然发现了一些损坏的链接
  2. 这些教程引用了 2 个不同的 url,但似乎与此相关 repository

https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams

<script src="https://apis.google.com/js/platform.js?onload=init" async defer></script>

https://developers.google.com/sheets/api/quickstart/js

<script async defer src="https://apis.google.com/js/api.js"
      onload="this.onload=function(){};handleClientLoad()"
      onreadystatechange="if (this.readyState === 'complete') this.onload()">

有什么区别?应该使用什么网址?有关系吗? 是否应该使用节点客户端而不是 Web 来编译它?

最佳答案

https://github.com/google/google-api-javascript-client/issues/658#issuecomment-692839901

sergentj 评论

The functionality in platform.js is a superset of the functionality in api.js. The documentation for those APIs is correct. If you are using both the sheets APIs and the sign-in API, platform.js will suffice, you needn't load both. You are correct that this is poorly documented, and we're aware that's a problem. Closing this since it is not going to be useful to track work on improving documentation (which is a much larger issue) here.

关于javascript - platform.js 还是 api.js?谷歌API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63039221/

相关文章:

javascript - 如何将我的 Ajax 处理移动到一个函数中?

java - 将不同的 URL 映射到 Web 应用程序

java - Keycloak公共(public)客户端和授权

javascript - 如何在 Bootstrap 4 中的标题中间写入文本

javascript - 如何通过 Firebreath 在 XUL 内部调用 javascript?

javascript - 颜色框定位在另一个元素之上

youtube - 如何通过YouTube官方PHP SDK将YouTube视频添加到播放列表

apache - 如何估计应用程序服务器的 RAM 大小?

android - 您指定的签名指纹已被另一个 Android OAuth2 客户端使用

php - 使用PHP从邮政编码获取经纬度