simple-captcha/captcha-passcheck.js

22 lines
952 B
JavaScript
Raw Permalink Normal View History

2025-02-15 17:00:26 +00:00
// Function to extract the "captcha" parameter from the iframe's URL
function getUrlParameter(url, name) {
const urlParams = new URLSearchParams(new URL(url).search);
return urlParams.get(name);
}
// Function to check CAPTCHA from the iframe
function checkCaptchaFromIframe() {
const iframe = document.getElementById('captcha-frame');
const iframeUrl = iframe.src; // Get the URL of the iframe
const captchaValue = getUrlParameter(iframeUrl, 'captcha');
// Check if the 'captcha' parameter exists and is a valid number
if (captchaValue && !isNaN(captchaValue)) {
document.getElementById('captcha-status').textContent = "CAPTCHA Passed!";
document.getElementById('captcha-status').style.color = "green";
} else {
document.getElementById('captcha-status').textContent = "CAPTCHA Failed. No valid answer found.";
document.getElementById('captcha-status').style.color = "red";
}
}