|
| 1 | +<!-- ---------------------------------------------------------------------- --> |
| 2 | +<!-- NOTE: Please add the following <META> element to your page <HEAD>. --> |
| 3 | +<!-- If necessary, please modify the charset parameter to specify the --> |
| 4 | +<!-- character set of your HTML page. --> |
| 5 | +<!-- ---------------------------------------------------------------------- --> |
| 6 | +<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"> |
| 7 | +<script src="https://www.google.com/recaptcha/api.js"></script> |
| 8 | +<script> |
| 9 | + function loadReCaptchaScript() { |
| 10 | + console.log("Loading Script for ReCaptcha"); |
| 11 | + const script = document.createElement('script'); |
| 12 | + script.src = 'https://www.google.com/recaptcha/api.js?render=6LffK08sAAAAAClHYNVW2AibUFtHhx0MhOtohO_X'; |
| 13 | + script.onerror = function() { |
| 14 | + console.error('Error loading the Turnstile script'); |
| 15 | + }; |
| 16 | + document.head.appendChild(script); // Append the script to the head of the document |
| 17 | + console.log("Loaded Script for ReCaptcha"); |
| 18 | + script.onload = function() { |
| 19 | + console.log("ReCaptcha script loaded successfully"); |
| 20 | + handleInvisibleReCaptcha(); |
| 21 | + }; |
| 22 | + } |
| 23 | + function handleInvisibleReCaptcha() { |
| 24 | + // Trigger the invisible Turnstile when needed (e.g., after a user action) |
| 25 | + console.log("rendering ReCaptcha"); |
| 26 | + grecaptcha.ready(function() { |
| 27 | + grecaptcha.execute('6LffK08sAAAAAClHYNVW2AibUFtHhx0MhOtohO_X', {action: 'submit'}).then(function (token) { |
| 28 | + console.log('ReCaptcha Token Generated :' + token.toString()); |
| 29 | + var captcha = document.getElementById("captcha"); |
| 30 | + captcha.innerHTML = token.toString(); |
| 31 | + |
| 32 | + |
| 33 | + }); |
| 34 | + }); |
| 35 | + } |
| 36 | + loadReCaptchaScript(); |
| 37 | + function timestamp() { var response = document.getElementById("g-recaptcha-response"); if (response == null || response.value.trim() == "") {var elems = JSON.parse(document.getElementsByName("captcha_settings")[0].value);elems["ts"] = JSON.stringify(new Date().getTime());document.getElementsByName("captcha_settings")[0].value = JSON.stringify(elems); } } setInterval(timestamp, 500); |
| 38 | +</script> |
| 39 | +<html> |
| 40 | +<head> |
| 41 | +<title>InApp</title> |
| 42 | +<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> |
| 43 | +</head> |
| 44 | + <body> |
| 45 | + <h1> Test ReCaptcha on Different browsers</h1> |
| 46 | + <h4 id="captcha"></h4> |
| 47 | + </body> |
| 48 | +</html> |
| 49 | +<!-- ---------------------------------------------------------------------- --> |
| 50 | +<!-- NOTE: Please add the following <FORM> element to your page. --> |
| 51 | +<!-- ---------------------------------------------------------------------- --> |
0 commit comments