Rails 使用 HTML CSS JS 添加 reCAPTCHA

rails add recaptcha using html css js

提问人:Manav 提问时间:8/28/2023 更新时间:8/28/2023 访问量:36

问:

我正在尝试添加没有宝石的 recatcha,

[![在此处输入图片描述][1]][1]

收到此js错误 [![在此处输入图片描述][2]][2]

我的 HTML 代码

  <div data-sitekey="6Le3iM4nAAAAAIALfDvasxzV0QuRI_UlRdBjlWr8" class="g-recaptcha ">
    <div style="width: 304px; height: 78px;">
      <div>
        <iframe title="reCAPTCHA" src="https://www.recaptcha.net/recaptcha/api2/anchor?ar=1&amp;k=6Le3iM4nAAAAAIALfDvasxzV0QuRI_UlRdBjlWr8&amp;co=aHR0cDovL2xvY2FsaG9zdDo0MTAw&amp;hl=en&amp;v=0hCdE87LyjzAkFO5Ff-v7Hj1&amp;size=normal&amp;cb=2quee45cpf0u" width="304" height="78" role="presentation" name="a-2qwxzh5nn77c" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox"></iframe>
      </div>
      <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea>
    </div>
    <iframe style="display: none;"></iframe>
  </div>
  <noscript>
    <div>
      <div style="width: 302px; height: 422px; position: relative;">
        <div style="width: 302px; height: 422px; position: absolute;">
          <iframe src="https://www.recaptcha.net/recaptcha/api/fallback?k=6Le3iM4nAAAAAIALfDvasxzV0QuRI_UlRdBjlWr8" name="ReCAPTCHA" style="width: 302px; height: 422px; border-style: none; border: 0; overflow: hidden;"></iframe>
        </div>
      </div>
      <div style="width: 300px; height: 60px; border-style: none;
          bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;
          background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">
        <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1;
            margin: 10px 25px; padding: 0px; resize: none;"></textarea>
      </div>
    </div>
  </noscript>

and I have added the script in the head tag

src = "https://www.google.com/recaptcha/api.js"


Basically on checking the spinner keeps on spinning and then i get a timeout

Please can someone help me with this.
javascript html ruby-on-rails,

评论

0赞 CBroe 8/28/2023
除此之外,看起来您一开始就没有正确上传/嵌入任何图像:请不要上传代码/数据/错误的图像。

答: 暂无答案