简体   繁体   English

未捕获(承诺中)错误:reCAPTCHA 占位符元素必须是元素或 id

[英]Uncaught (in promise) Error: reCAPTCHA placeholder element must be an element or id

I've found similar questions being asked here, but I've checked everything suggested and I couldn't find the issue.我在这里发现了类似的问题,但我检查了所有建议,但找不到问题。 On the page https://www.basement-supercomputing.com/create-an-account/ I have the JavaScript error在页面https://www.basement-supercomputing.com/create-an-account/我有 JavaScript 错误

Uncaught (in promise) Error: reCAPTCHA placeholder element must be an element or id未捕获(承诺中)错误:reCAPTCHA 占位符元素必须是元素或 id

This indicates that reCaptcha doesn't find the element to add itself onto the page as far as I understand.据我所知,这表明 reCaptcha 没有找到将自己添加到页面上的元素。 However, if I check the page source, I can see the HTML tag: https://monosnap.com/file/PeYWAw7wfSENan2At5VaGQ1ghErqhb但是,如果我检查页面源,我可以看到 HTML 标签: https://monosnap.com/file/PeYWAw7wfSENan2At5VaGQ1ghErqhb

<div class="recaptcha controls">
    <div id="hika-recaptcha" class="hika-recaptcha"></div>
    <script type="text/javascript">
        var onloadCallbackHKRecaptcha = function() {
            window.hkCaptchaWidget = grecaptcha.render('hika-recaptcha', {'sitekey':'6LeexMISAAAAAIVTKhGZyvOmfc4s7Fqh-xo2a6t8', 'theme':'light'});

        };
        var scriptTag = document.createElement('script');
        scriptTag.src = "https://www.google.com/recaptcha/api.js?onload=onloadCallbackHKRecaptcha&render=explicit&hl=en-GB";
        scriptTag.defer = true;
        document.body.appendChild(scriptTag);
    </script>
</div>

I also read that such error could happen if there was several tags with the same id (that's not the case), or if recaptcha was loaded several times on the page (that's not the case either).我还读到如果有多个具有相同 id 的标签(不是这种情况),或者如果在页面上多次加载 recaptcha(也不是这种情况),可能会发生这种错误。 It could also happen if the javascript is run before the tag is added on the page, but the tag is already there and even before the javascript of recaptcha on the page.如果在页面上添加标签之前运行 javascript,但标签已经存在,甚至在页面上的 recaptcha 的 javascript 之前运行,也会发生这种情况。 I also checked with the same ReCaptcha code on localhost it works just fine: https://monosnap.com/file/2g0AgAWducwtjchIoC3Sf3uFxRuE3B Finally, note that in both cases, the website is made with the Joomla CMS.我还在 localhost 上检查了相同的 ReCaptcha 代码,它工作得很好: https://monosnap.com/file/2g0AgAWducwtjchIoC3Sf3uFxRuE3B最后,请注意,在这两种情况下,网站都是使用 Z57AC91865E5064F2310CF620988225 制作的。

I don't see any reason why it wouldn't work so if someone has an idea, that would be great !我看不出它为什么不起作用的任何原因,所以如果有人有一个想法,那就太好了! Thanks in advance提前致谢

Just ran across this issue myself.我自己也遇到过这个问题。 Looking at the stack trace, it appears that you are using moo tools (and so was I).查看堆栈跟踪,您似乎正在使用 moo 工具(我也是)。 It appears that if you remove it or update moo tools, it should resolve the recaptcha error.看来,如果您删除它或更新 moo 工具,它应该可以解决 recaptcha 错误。 Thanks to another similiar post here: Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id感谢另一个类似的帖子: Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Recaptcha 2.0 错误:reCAPTCHA 占位符元素必须是元素或 id - Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id ReCAPTCHA 占位符元素必须是元素或 id - ReCAPTCHA placeholder element must be an element or id 错误:reCAPTCHA 占位符元素必须是一个元素或 - Error: reCAPTCHA placeholder element must be an element or 错误:ReCAPTCHA 占位符元素必须为空 - Error: ReCAPTCHA placeholder element must be empty GettUncaught 错误:reCAPTCHA 占位符元素必须为空; 只加载一次 - GettUncaught Error: reCAPTCHA placeholder element must be empty ; loaded only once 验证码:“ bind参数必须是元素或id” - ReCaptcha: “The bind parameter must be an element or id” 使用 emailjs 重新捕获后控制台出现“未捕获(在承诺中)TypeError”错误 - 'Uncaught (in Promise) TypeError' error in console after recaptcha with emailjs ng-recaptcha ERR:错误:“未捕获(承诺):[对象空]” - ng-recaptcha ERR: Error: "Uncaught (in promise): [object Null]" 未捕获(在承诺中)提供的元素不在文档中 - Uncaught (in promise) Provided element is not within a Document 未捕获的错误:元素缓存中ID为x的DOM元素与DOM中的元素不同 - Uncaught Error: DOM element with id x in Element cache is not same as element in DOM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM