Recaptcha 2 (a.k.a.nocaptcha) 在首次加载时不会在 Internet Explorer 8 上加载

Recaptcha 2 (a.k.a. nocaptcha) doesn't load on Internet Explorer 8 on first load

我正在使用新的 recaptcha2,一切似乎在所有现代浏览器上都能完美运行,但我只有 IE8 有问题。

验证码在第二次和下次访问页面时正确加载,但从不在第一次加载或在隐私模式下加载。

更奇怪的是,google recaptcha 2 page demo doesn't have this problems. I am using django-nocaptcha-recaptcha package, which is based on recaptcha-client换成了python,所以我觉得我的配置还是挺标准的。

控制台没有显示任何错误。 div 不是由 recaptcha 代码填充的。

Google their recaptcha2 developers guide 建议使用这样的代码片段:

<html>
  <head>
    <title>reCAPTCHA demo: Simple page</title>
     <script src="https://www.google.com/recaptcha/api.js" async defer></script>
  </head>
  <body>
    <form action="?" method="POST">
      <div class="g-recaptcha" data-sitekey="your_site_key"></div>
      <br/>
      <input type="submit" value="Submit">
    </form>
  </body>
</html>

django-nocaptcha-recaptcha 使用类似 piece of code 并且还使用这样的一行:

<script src="https://www.google.com/recaptcha/api.js" async defer></script>

这可能会导致问题,因为 IE 10+ 支持 ascyncdefer。就我而言,当我使用:

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

问题消失:)