This is a follow up to my Recaptcha call back can be found when it is the only function but not when other ones are included
.
Here is the link: Recaptcha call back can be found when it is the only function but not when other ones are included
Now I am not getting an error where ReCaptcha cannot find the callback function but instead I am getting this error: anchor:1 Uncaught (in promise) ReferenceError
When you click on anchor:1
, it takes you to a page which I guess is where the ReCaptcha checkbox is hosted.
This was the URL https://www.google.com/recaptcha/api2/anchor?ar=1&k=I_SUPPOSE_THIS_IS_SITE_KEY&hl=en&v=TDBxTlSsKAUm3tSIa0fwIqNu&size=normal&cb=52k0t5ji16jq
That is how I know this has something to do with ReCaptcha...
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Jerry Bot Verication</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<form action="?" method="post" class="recaptchaDIV">
<div class="g-recaptcha" data-callback="onloadCallback" data-sitekey="MY_SITE_KEY_WAS_HERE"></div>
</form>
<script type="text/javascript">
function onloadCallback() {
addPerson();
}
</script>
<script type="module">
window.addPerson = addPerson;
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const userVar = urlParams.get('user')
userVarSplitted = userVar.split('#')
userVarFormatted = userVarSplitted[0] + ":" + userVarSplitted[1]
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-analytics.js";
import { getDatabase } from "firebase/database";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
#firebase config
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const db = getDatabase();
function addPerson() {
set(ref(db, "verified/" + userVarFormatted), {
name: userVarSplitted[0],
discriminator: userVarSplitted[1]
});
console.log("added")
}
</script>
<style>
html, body{
height: 100%;
}
body{
display: flex;
background: #fff;
padding: 0px;
margin: 0px;
}
.recaptchaDIV{
margin: auto;
}
</style>
</body>
</html>
Do you know what's happened?
Thanks