- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我只是尝试在提交表单后让 Google Invisible ReCaptcha 工作。我的问题是,ReCaptcha 不是不可见的,它看起来像“旧的”recaptcha 正在弹出。我不明白为什么。我的站点 key 用于不可见的重新验证。请帮助我。
首先我正在加载 API:
<script src='https://www.google.com/recaptcha/api.js?render=explicit&onload=onScriptLoad' async defer></script>
我的表格是这样的:
<form method="post" id="contact-form-face" class="clearfix" onsubmit="return false">
<input type="text" required name="name" value="name" onFocus="if (this.value == 'name') this.value = '';" onBlur="if (this.value == '') this.value = 'name';" />
<button type="submit" id="sendButton" data-size="invisible" class="g-recaptcha contact_btn" onclick="onSubmitBtnClick()" value="send" >send</button>
</form>
JS:
window.onScriptLoad = function () {
// this callback will be called by recapcha/api.js once its loaded. If we used
// render=explicit as param in script src, then we can explicitly render reCaptcha at this point
// element to "render" invisible captcha in
var htmlEl = document.querySelector('.g-recaptcha');
// option to captcha
var captchaOptions = {
sitekey: 'XXXXXXX',
size: 'invisible',
// tell reCaptcha which callback to notify when user is successfully verified.
// if this value is string, then it must be name of function accessible via window['nameOfFunc'],
// and passing string is equivalent to specifying data-callback='nameOfFunc', but it can be
// reference to an actual function
callback: window.onUserVerified
};
// Only for "invisible" type. if true, will read value from html-element's data-* attribute if its not passed via captchaOptions
var inheritFromDataAttr = true;
console.log("render now!");
// now render
recaptchaId = window.grecaptcha.render(htmlEl, captchaOptions, inheritFromDataAttr);
};
// this is assigned from "data-callback" or render()'s "options.callback"
window.onUserVerified = function (token) {
alert('User Is verified');
console.log('token=', token);
};
// click handler for form's submit button
function onSubmitBtnClick () {
var token = window.grecaptcha.getResponse(recaptchaId);
// if no token, mean user is not validated yet
if (!token) {
// trigger validation
window.grecaptcha.execute(recaptchaId);
return;
}
var xhrData = {
'g-recaptcha-response': token
// more ajax body/data here
};
};
为了让事情更清楚:这个 reCaptcha 工作正常,回调加载,验证也工作正常......唯一的问题是,这个 recaptcha 必须是不可见的,而它不是:/
最佳答案
我认为你的问题是你显式地调用了 render() 方法
recaptchaId = window.grecaptcha.render(htmlEl, captchaOptions, inheritFromDataAttr);
};
如果你想让它不可见,你必须包含这个自定义DIV
<div class="g-recaptcha"
data-sitekey="your_site_key"
data-callback="onSubmit"
data-size="invisible">
</div>
https://developers.google.com/recaptcha/docs/invisible
recaptcha 脚本将查找 div 类元素并将其绑定(bind)在那里,然后在调用 recaptcha 验证时执行回调。
调用 recaptcha 验证使用 grecaptcha.execute();
按照 googledev 页面中的示例,非常简单。
希望对您有所帮助 =)
关于javascript - Google Invisible ReCaptcha 不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43733787/
我已经实现了不可见的 reCAPTCHA,一切正常,但谷歌以他们的智慧添加了一个条款/隐私框作为屏幕右下角的覆盖: 不幸的是,因为我已经有一个时间表框,所以它看起来很乱。 Google 和我的调度程序
有点直截了当:当 asp:Validators 在不可见的容器中时,它们是否仍会执行验证?如果他们的 ControlToValidate 目标是不可见的呢? 例如: 上面是不可
我是 Android 开发的新手,所以我正在开发一个简单的应用程序来隐藏按下某个按钮的 TextView ,因此在按钮的 OnClick 事件方法的 java 代码中我将 TextView 设置为不可
?invisible说 Return a (temporarily) invisible copy of an object. 那个括号暗示隐形不会永远持续下去,但我找不到任何可以解释它何时消失的东西
根据 Lighthouse 的测量,包含 Google 的“隐形验证码”似乎大大增加了“首次交互”(以及随后的“持续交互”)时间。 我使用 HTML5 样板模板设置了两个空网页。这些站点的不同之处仅在
我有一个不可见的 recaptcha,它可以工作,但对所有用户来说都是完全可见的。我的意思是: 我的控制台说: Uncaught Error: Missing required parameters:
我正在编写简单的 APN 切换应用程序。我想问一下如何强制android不显示任何窗口。目前在运行我的应用程序后,会短暂显示带有应用程序名称的黑屏,然后消失。是否可以不显示任何内容(仅显示 Toast
在我的应用程序中,我有一些控件,例如 NSButton 和 NSTextfield,我想将其隐藏。我知道我可以在 Interface Builder 中做到这一点,但我需要在代码中做到这一点。 我仍然
我想从所有市场上删除“待售” ios应用程序,因此不再可以购买,但仍可以为现有用户提供更新。这可能吗? 马丁 最佳答案 不,如果您要提供更新,则任何人都必须可以下载/购买。 恐怕是标准的苹果程序。苹果
这个问题已经有答案了: Eclipse pausing without a breakpoint (6 个回答) 已关闭 8 年前。 我正在使用 Eclipse Juno。当我调试桌面应用程序时,调试
我在 FMX 上有一个 TGrid,有 3 列,第二列是 Visible False,如果我单击第一列并按箭头聚焦于下一个可见列,光标不会转到第三列,它会消失,就像聚焦在第二列上一样,如果我再次按下箭
这是我的进度对话框 progressBar = new ProgressDialog(Wallpapers.this); progressBar.setCancelable(false); progr
我正在尝试从使用 Google reCaptcha v2 迁移到不可见的 reCaptcha。我使用 Parsley.js 进行表单验证,并使用 Malsup Ajax 表单插件提交表单。我当前的代码
而不是使用: if ( ! $('#XX').is(':visible) ) 是否有一个名为 invisible 的值?我试过了,但不起作用。 谢谢! 最佳答案 ':hidden' if ($('#X
这些是 “程序员可见” x86-64 寄存器: (来源:usenix.org) 隐形寄存器呢?刚刚才知道MMU寄存器,Interrupt Descriptor Table(IDT)使用了这些不可见的寄
我正在创建一个类库,里面有不同的功能。我还有一个控制台应用程序,一旦它们引用类库就可以访问这些函数。我想知道如何使一个函数“不可见”,这样客户就看不到它的存在,只有在他们完美地写出来的情况下他们才能使
我需要您的帮助,从图形类生成屏幕外图像并将其转换为二进制数据,而不将它们设置在屏幕上可见。我想生成大量标签并将它们作为二进制数据发送到打印机。如果我创建图像,在屏幕上显示它然后发送它,一切都很好,但是
假设我有以下代码: //myjs.js let testingVisibility = "hello"; 当我想通过 Firefox 中的控制台访问 testingVisibility 变量时,未声
在 Swift 中,我可以创建一个 String 变量,如下所示: let s = "Hello\nMy name is Jack!" 如果我使用 s,输出将是: Hello My name is J
我必须编写一些 javascript 代码来截取网页的屏幕截图,但不能在前台渲染它。首先,这可能吗?我需要使用一些外部库吗?请给我一些想法:) 最佳答案 如果您正在谈论在 Firefox chrome
我是一名优秀的程序员,十分优秀!