|
8 | 8 |
|
9 | 9 | <h1> In APP Web Client for TestCaptcha miaw2 sdb6 Deployment</h1> |
10 | 10 | <p><a id="editThisPageLink" target="_blank" style="color:blue">Edit this pages</a></p> |
11 | | - <script src="https://www.google.com/recaptcha/api.js" async defer></script> |
| 11 | +<script src="https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit" async defer></script> |
| 12 | +<script> |
| 13 | + document.getElementById('editThisPageLink').href = |
| 14 | + "https://github.com/shreerammohanty/miawtest/edit/master/1ShreeRam/LocalSdb6Connect.html"; |
| 15 | + |
| 16 | + let recaptchaWidgetId = null; |
| 17 | + |
| 18 | + function onRecaptchaLoad() { |
| 19 | + recaptchaWidgetId = grecaptcha.render('recaptcha-container', { |
| 20 | + sitekey: '6Lfy2HMrAAAAAIVf2zhrlxQ-6ht07tNdfNUrD3p9', |
| 21 | + size: 'invisible', |
| 22 | + callback: onVerify, |
| 23 | + 'error-callback': onError, |
| 24 | + 'expired-callback': onExpired |
| 25 | + }); |
| 26 | + |
| 27 | + // Execute immediately, no button required |
| 28 | + grecaptcha.execute(recaptchaWidgetId); |
| 29 | + } |
| 30 | + |
| 31 | + function onVerify(token) { |
| 32 | + console.log('reCAPTCHA token:', token); |
| 33 | + // TODO: POST the token to your backend for verification |
| 34 | + // fetch('/verify', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ token }) }); |
| 35 | + } |
| 36 | + |
| 37 | + function onError() { |
| 38 | + console.error('reCAPTCHA error'); |
| 39 | + } |
| 40 | + |
| 41 | + function onExpired() { |
| 42 | + console.warn('reCAPTCHA expired, re-executing…'); |
| 43 | + grecaptcha.execute(recaptchaWidgetId); |
| 44 | + } |
| 45 | +</script> |
12 | 46 | <script>document.getElementById('editThisPageLink').href = "https://github.com/shreerammohanty/miawtest/edit/master/1ShreeRam/sdb6chat1.html";</script> |
13 | 47 |
|
14 | 48 |
|
|
0 commit comments