在 AMP 网页中显示一键显示功能

如需向您的 AMP 网页添加一键式登录,请执行以下操作:

  1. 将 One Tap 添加到您自己网站上托管的中间 iframe。

  2. 使用 <amp-onetap-google> 组件将中间 iframe(而非 One Tap)嵌入到 AMP 页面中。

将以下代码段放置在您希望 Google One Tap 显示的任何 AMP 网页中:

<script custom-element="amp-onetap-google" src="https://cdn.ampproject.org/v0/amp-onetap-google-0.1.js" async></script>
<amp-onetap-google
  layout="nodisplay"
  data-src="https://example.com/onetap_iframe.html">
</amp-onetap-google>

data-src 属性设置为中间 iframe 的 URI。