All Questions
Tagged with recaptcha javascript
1,011
questions
266
votes
15
answers
310k
views
How to hide the Google Invisible reCAPTCHA badge
When implementing the new Google Invisible reCATPTCHA, by default you get a little "protected by reCAPTCHA" badge in the bottom right of the screen that pops out when you roll over it.
I'd like to ...
211
votes
9
answers
226k
views
How to Reload ReCaptcha using JavaScript?
I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (i.e. username already in use).
I am looking for a code compatible with ReCaptcha to reload it ...
161
votes
17
answers
423k
views
How can I validate google reCAPTCHA v2 using javascript/jQuery?
I have a simple contact form in aspx.
I want to validate the reCaptcha (client-side) before submitting the form.
Please help.
Sample code:
<%@ Page Language="VB" AutoEventWireup="false" ...
123
votes
23
answers
174k
views
ReCaptcha API v2 Styling
I have not had much success finding how to style Google's new recaptcha (v2). The eventual goal is to make it responsive, but I am having difficulty applying styling for even simple things like width.
...
98
votes
7
answers
113k
views
How to check in js that user has checked the checkbox in Google recaptcha?
I have added the following before end of head
<script src='https://www.google.com/recaptcha/api.js'></script>
I have added this before end of form
<div class="g-recaptcha" data-...
82
votes
2
answers
82k
views
ReCaptcha 2.0: enable Submit button on callback if recaptcha successful
I have a very simple form as follows. I want to make it so that the Submit button is disabled, and only enabled after the user has successfully completed the ReCaptcha.
I'm assuming I'm going to need ...
80
votes
11
answers
86k
views
Google reCaptcha response "Uncaught (in promise) null"
I'm use reCaptcha v2 but in dev console response Uncaught (in promise) null in in any case (and moving the .reset() function)
console:
my code for recaptcha:
<div class="text-xs-center" style="...
60
votes
8
answers
95k
views
How can I make reCAPTCHA a required field?
I'm using Google reCAPTCHA and have been able to add the CAPTCHA component to my page inside a form. But when I submit the form there's no validation taking place to check if the CAPTCHA has been ...
56
votes
1
answer
63k
views
ReCaptcha 2.0 With AJAX
I have managed to get ReCaptcha 2.0 working in my website. However, it's only working when I don't use AJAX and I let the form submit "naturally".
I want to submit the form with the captcha and ...
55
votes
10
answers
70k
views
Error: ReCAPTCHA placeholder element must be empty
I am using recaptcha with my laravel application.
I just want to check recaptcha's response on form submit using jquery and stop user by alert that pleade validate captcha.
but , I could not stop ...
55
votes
4
answers
76k
views
New reCaptcha with jQuery Validation Plugin
I searched and can't figure out how to validate the new reCaptcha, before form submit, along with the validate function of jQuery validation Plugin.
My intent:
$.validator.addMethod('...
52
votes
5
answers
45k
views
Setting reCAPTCHA Version 2 set another language other than English
How can I set this in another language, ie:. French
I've tried:
var RecaptchaOptions = {
lang : 'fr',
};
Found above here
Which does nothing.
I couldn't find relevant info under API ...
47
votes
1
answer
5k
views
Recaptcha V3 error incorrect-captcha-sol randomly
I'm getting incorrect-captcha-sol error code sometime while using Google reCAPTCHA server side verification api.
I have integrated google recaptcha validation to some of my apis.
To do so, I pass ...
46
votes
4
answers
208k
views
Google reCAPTCHA: How to get user response and validate in the server side?
I am doing a Java (JSP + Servlet) web application (I understand that this question is technology-independent). I hope to use the latest Google reCAPTCHA service.
I am playing with a Google reCAPTCHA ...
44
votes
2
answers
44k
views
ReCaptcha v2 client side events
Does ReCaptcha v2 expose any client side events? I am looking specifically to identify when the Captcha response has been returned once the box is ticked, so I can reveal the "Continue" button below.
...
42
votes
9
answers
118k
views
Uncaught ReferenceError: grecaptcha is not defined
I am using recaptcha v2
I am getting the following error occasionally (sometimes i don't get error and sometimes i do get it)
Uncaught ReferenceError: grecaptcha is not defined
It seems because of ...
36
votes
5
answers
83k
views
Implement the new Invisible reCaptcha from Google
I'm building a PHP website where I would like to put a captcha on the login form. I went with Google's new Invisible reCaptcha but I'm having trouble with implementing it (HTML part, the PHP is ...
35
votes
11
answers
83k
views
How to reload the google recaptcha widget after user submits invalid inputs
I have a registration form with the new google recaptcha widget on it. When a user submits info, we check the validation with javascript and return the problems to the page (ex: "please use a valid ...
34
votes
3
answers
16k
views
How to run reCaptcha ONLY if HTML5 validation has passed?
Usually, HTML5 form validation runs before the submit event.
With this
<form id="myForm">
<input type="text" name="foo" required />
<button type="submit"> Submit </...
32
votes
8
answers
70k
views
How to use .env variables in Nuxt 2 or 3?
I have .env file in the project root, and in my nuxt config I am using variables to configure ReCaptcha like this:
import dotenv from 'dotenv'
dotenv.config()
export default {
modules: [
[...
30
votes
6
answers
66k
views
Google reCaptcha reset doesn't work
I want to reset Google reCaptcha widget when I submit my form via AJAX and have some input errors or form is sent. I'm using multiple widgets on the same page so I render these widgets explicitly.
My ...
29
votes
1
answer
59k
views
Google reCAPTCHA data-callback not working
I have built a email newsletter signup form which posts into mailchimp from my website. I have Google reCAPTCHA added to the form and have a data-callback to enable the submit button as it is ...
28
votes
6
answers
46k
views
Require User to click google's new recaptcha before form submission
I am using google's new recaptcha inside my form (HTML5):
https://www.google.com/recaptcha
Is there a way to check and mark recaptcha as required before form submission?
I want to validate this on ...
25
votes
8
answers
31k
views
Vue.js google reCaptcha callback
I am trying to get recaptcha callback working with vue.js in a component. The captcha itself does work, but not the callback that I define in the data-callback attribute.
I've tried everything I ...
25
votes
4
answers
90k
views
Google reCAPTCHA V3.0 not working. "ERROR for site owner: Invalid key type"
I can't get the Google reCAPTCHA to work on my Squarespace form.
Site Key and Secret Key are both entered correctly. Both domains have been entered as well.
Both Client Side integration codes have ...
23
votes
3
answers
26k
views
How Google's reCAPTCHA v3 works
Google has rolled out reCAPTCHA v3. It does away with all the user friction. I wish to use it to secure my site. However, I am unsure about how this is going to protect my site. What if a hacker spams ...
22
votes
2
answers
9k
views
Google Recaptcha javascript loading multiple times
I'm including the Google Recaptcha on my website in the following way;
In the header section;
<script async src='https://www.google.com/recaptcha/api.js?hl=fr'></script>
And in the body ...
21
votes
6
answers
60k
views
Google REcaptcha not showing
I have the following in my <body>
<div class="g-recaptcha" data-sitekey="some-key (original is right)">
and this on my <head>
<script src="//www.google.com/recaptcha/api.js">...
21
votes
2
answers
5k
views
Recaptcha v2 throws an error when it is reset and its container element is removed from DOM
When I explicitly render Recaptcha v2 and then reset it before removing it from the DOM, after ~40 seconds I get an error in the browser console.
I have a JSFiddle which can be used to reproduce the ...
20
votes
2
answers
30k
views
Prevent google recaptcha setting a cookie (GDPR)
We have integrated with Google recaptcha, and it sets some cookies with user data (example cookie is NID). On 25th of May, the GDPR will be live, and according to that law, website cannot set any ...
19
votes
4
answers
52k
views
Explicitly Rendering ReCaptcha - Onload Function Not Firing
From the documentation I understood that in order to change the language of the recaptcha I have to render it explicitly.
The problem is, however, that it's not really showing up, and the onload ...
17
votes
2
answers
5k
views
implement reCAPTCHA v3 in WordPress loginscreen
Google just released a new beta version of their recaptcha: reCaptcha v3.
I am trying to implement this in my WordPress login screens. However it does show the recaptcha logo in the bottom right ...
16
votes
7
answers
37k
views
Load reCAPTCHA dynamically
There are several ways to load reCAPTCHA using javascript such as below:
<html>
<head>
<title>Loading captcha with JavaScript</title>
<script src="https://code....
16
votes
6
answers
11k
views
detect when challenge window is closed for Google recaptcha
I am using Google invisible recaptcha. Is there a way to detect when the challenge window is closed? By challenge window I mean window where you have to pick some images for verification.
I currently ...
16
votes
2
answers
2k
views
How to protect jquery button with Invisible reCaptcha?
I want to protect my jquery button from bots without annoying the users, so i thought of adding google's invisible recaptcha to it. However implementation isn't as easy as i though and i can't seem to ...
16
votes
2
answers
1k
views
reCAPTCHA stopped working - Invalid Encryption
I have been using reCAPTCHA on my site for a while now and suddenly I realized it has stopped to work. The reCAPTCHA is there, however after verifying correctly, the response FAILS which makes the ...
16
votes
2
answers
2k
views
New Google reCAPTCHA JavaScript namespace callback
We're trying to implement the new Google reCAPTCHA on our website, however when we try and load a callback from it using a namespaced function, the callback does not run.
Changing the callback to ...
15
votes
2
answers
14k
views
Invisible google Recaptcha and ajax form
I have an ajax form:
<form id="my_form">
<input type="text" id="field1" />
<input type="submit" value="submit" />
</form>
And js code:
document.getElementById("...
15
votes
2
answers
2k
views
Google Recaptcha is not showing after click on radio button
I have two radio buttons. When I click into one of them to change the form fields, the captcha version 1 does not show anymore.
So, I have to click the refresh button to generate a new captcha image....
14
votes
1
answer
25k
views
How to reset Google reCaptcha?
Here is my PHP Code:
function post_captcha($user_response) {
$fields_string = '';
$fields = array(
'secret' => '',
'response' => $user_response
);
foreach($...
14
votes
5
answers
20k
views
Google "reCaptcha" sometimes doesn't get displayed/rendered
Sometimes I have to reload the webpage multiple times till the reCaptcha gets rendered. I and a friend tested both on Firefox and Chrome but the problem is consistent and doesn't seem to depend on the ...
14
votes
3
answers
43k
views
Invisible reCAPTCHA - Missing required parameters: sitekey
I am loading Invisible reCAPTCHA dynamically for every form with button that has class g-recaptcha .
Problem that I have is that captcha is not loading correctly and I am not sure why. I followed ...
13
votes
7
answers
27k
views
How to add multiple invisible recaptcha in single page?
I have added two invisible recaptcha divs but when i saw the code in inspect element then only one invisible recaptcha added in my single page.
My code is:
<div id="captcha1" class="g-recaptcha"
...
13
votes
4
answers
20k
views
reCAPTCHA V3: how to deal with expired token after idle?
For Google reCAPTCHA V2 it was clear what to do when the token gets expired because of idle: the customer has a change to click on the reCaptcha checkbox again.
For Google reCAPTCHA V3 it is ...
13
votes
2
answers
16k
views
Validate multiple recaptcha (V2) on the same page
I was wondering how to validate Recaptcha client side, when there are multiple on the same page. I found this https://stackoverflow.com/a/28607943/5649602, and that is OK when i have one.
But now i ...
13
votes
3
answers
14k
views
"Not a robot" recaptcha without a <form> but AJAX instead
The traditional way of using "I am not a robot" Recpatcha seems to be with a <form> on client-side:
<form action="post.php" method="POST">
<div class="g-recaptcha" data-sitekey="...
13
votes
3
answers
26k
views
Invisible ReCaptcha with jQuery ajax
I am trying to implement the newest ReCaptcha (aka "invisible" ReCaptcha) within an form using jQuery and an "ajax" request.
ReCaptcha documentation: https://developers.google.com/recaptcha/docs/...
13
votes
2
answers
2k
views
firebase docs reference grecaptcha but never import or define it
From https://firebase.google.com/docs/auth/web/phone-auth:
If signInWithPhoneNumber results in an error, reset the reCAPTCHA so
the user can try again:
grecaptcha.reset(window.recaptchaWidgetId);...
13
votes
2
answers
10k
views
elusive recaptcha bug. Copy code always fails
A very small amount of my users get a captcha that asks them to copy and paste a code, but it always fails for them - while most of the users get the normal one (checkbox) which goes through correctly....
13
votes
3
answers
16k
views
reCaptcha v3 handle score callback
I followed recaptcha v3 example and managed to make it return a callback with a score for a page, similar with their demo.
What I don't understand is how to handle the score that is returned.
I ...