如何在使用Google ReCaptcha版本2时更改错误消息? [英] How can I change the error message when using Google ReCaptcha version 2?
问题描述
为Google ReCaptcha版本2选择多张照片时,会显示以下错误消息:
When multiple photos are selected for the Google ReCaptcha version 2, it displays the following error message:
需要多个正确的解决方案 - 请解决更多问题。
"Multiple correct solutions required - please solve more."
如何将错误消息更改为来自我网站的自定义消息?
How can i change the error message to be a custom message from my site?
以下是图片:
推荐答案
我认为不可能做服务器端(谷歌)。这可能是通过利用js替换新收到的reCaptcha图片代码的HTML来完成客户端:
I think it's not possible to do server-side (at google). This rather might be done client-side by leveraging js to substitute HTML of the newly received reCaptcha pictures code:
<div class="rc-imageselect-incorrect-response" style="">Multiple correct solutions required – please solve more.</div>
所以你找到这行代码并替换:
so you find this line of code and replace:
$('.rc-imageselect-incorrect-response').text('Custom message');
什么时候?
你应该这个动作XHR后每次执行 https://www.google.com/recaptcha/ api2 / userverify?k = 6LdYKQkTAAAAAD9K6-kHspFU ...已完成。然而,由于这个ajax请求是由google的reCaptcha的api代码完成的,所以赶上它并不容易。
When?
This action you should perform each time after XHR https://www.google.com/recaptcha/api2/userverify?k=6LdYKQkTAAAAAD9K6-kHspFU... is complete. Yet since this ajax request is done by google's reCaptcha's api code, it's not that easy to catch up with it.
这篇关于如何在使用Google ReCaptcha版本2时更改错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!