hCaptcha JavaScript API呈现:无效容器';空';
我在opera开发者控制台上遇到这个错误。 我替换了我的站点密钥,它返回了无效的容器null 这是我的源代码hCaptcha JavaScript API呈现:无效容器';空';,javascript,api,recaptcha,captcha,Javascript,Api,Recaptcha,Captcha,我在opera开发者控制台上遇到这个错误。 我替换了我的站点密钥,它返回了无效的容器null 这是我的源代码 <html> <head> <script src="https://hcaptcha.com/1/api.js?onload=yourFunction&render=explicit" async defer></script> <script type="t
<html>
<head>
<script src="https://hcaptcha.com/1/api.js?onload=yourFunction&render=explicit" async defer></script>
<script type="text/javascript">
var yourFunction = function () {
console.log('hCaptcha is ready.');
var widgetID = hcaptcha.render('captcha-1', { sitekey: 'MY_SITE_KEY' });
};
</script>
</head>
<body>
<div class="h-captcha" data-sitekey="MY_SITE_KEY" data-theme="dark"></div>
</body>
</html>
var yourFunction=函数(){
log('hCaptcha已准备就绪');
var widgetID=hcaptcha.render('captcha-1',{sitekey:'MY_SITE_KEY'});
};
当隐式调用render
时,默认的集装箱ID
为h-captcha
,如目标div的类中所定义
当显式调用hcaptcha.render()
时,第一个参数是containerId
由于这种行为,您的问题可以通过将render()
调用的第一个参数更改为h-captcha
而不是captcha-1
,或者将class
值更改为captcha-1来解决。如果像我这样的人尝试将class和id更改为h-captcha,这将是有效的。谢谢你的帮助