Hey there! I encountered an issue with my website where the recaptcha isn't working on the desktop version. It's strange because I've used the same code successfully on other sites before.
I attempted to fix it by creating a new recaptcha and testing it in different browsers, but to no avail.
Some users suggested that I might be loading the recaptcha twice, but after checking my files, I can't seem to find any duplicates other than the google api link in the header.
The header:
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
</head>
My contact form's recaptcha section looks like this:
<div class = "row d-none d-sm-none d-md-block">
<div class = "col-md-6">
<div class="g-recaptcha" id = "captcha" name = "captcha" data-sitekey="SITE_KEY_HERE" style = "text-align:left;"></div>
</div>
<div class = "col-md-6">
<div class = "submit" style = "text-align: right;">
<button id = "submitForm" type="submit" name = "submit" class="btn btn-lg">Send Message</button>
</div>
</div>
</div>
<div class = "row d-inline-block d-sm-inline-block d-md-none">
<div class = "col-sm-12 text-center">
<div class="g-recaptcha" id = "captcha" name = "captcha" data-sitekey="SITE_KEY_HERE" style = "text-align:center;"></div>
</div>
</div>
<div class = "row d-block d-sm-block d-md-none">
<div class = "col-sm-12 text-center">
<div class = "submit">
<button id = "submitForm" type="submit" name = "submit" class="btn btn-lg">Send Message</button>
</div>
</div>
</div>
Upon the expected appearance of the 'I am not a robot' checkbox, I encountered the following error on the desktop version:
ERROR for site owner: Invalid domain for site key
Interestingly, the mobile version works flawlessly.
Even after assigning unique recaptcha keys for the desktop and mobile versions, the issue remains unresolved.