I have the following (simplified) .net code set up based on what I was able to glean from the documentation.
<html>
<head>
<script type="text/javascript">
var captcha;
var onloadCallback = function () {
captcha = grecaptcha.render('dvCaptcha', {
'sitekey': '<%=WebConstants.GoogleSiteKey %>',
'theme': 'light'
});
};
function VerifyCaptcha() {
console.log(grecaptcha.getResponseHeader(captcha));
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="dvCaptcha"></div>
<asp:Button ID="btnSubmit" runat="server" Text="submit" OnClick="btnSubmit_Click" OnClientClick="return VerifyCaptcha();" />
</form>
</body>
</html>
When I click the button which calls the VerifyCaptcha function I get "undefined is not a function" and it's pointing to what I'm assuming is the google injected code line 2
with (__commandLineAPI || { __proto__: null }) {
grecaptcha.getResponseHeader()
}
Does anyone see what I might be doing wrong with my code? Thanks.