是否可以在amp页面中使用Recaptcha组件?

问题描述

我正在将页面转换为Google amp页面,下面提供了页面链接

https://ppcexpo.com/Contactus

我正在此页面中使用Recaptcha控件,该控件是使用https://www.google.com/recaptcha/api.js脚本创建的。我想在Google AMP中使用相同的Recaptcha功能,该怎么办?

解决方法

您需要使用amp-recaptcha-input组件

<script async custom-element="amp-recaptcha-input" src="https://cdn.ampproject.org/v0/amp-recaptcha-input-0.1.js"></script>

使用:

<form amp-form-attributes-go-here>
  ...
  <amp-recaptcha-input layout="nodisplay" name="reCAPTCHA_body_key" data-sitekey=”reCAPTCHA_site_key" data-action="reCAPTCHA_example_action">
  </amp-recaptcha-input>
  ...
</form>