Saturday, October 25, 2025
HomeLanguagesJavascriptAutomatic Captcha Verification using JavaScript

Automatic Captcha Verification using JavaScript

Captcha: Captcha is a program used to protects websites through bots. It generates some tests that human can read and pass it but current computer can not do. For example, humans can read distorted text but computer can not read. The CAPTCHA is the abbreviation of Completely Automated Public Turing Test To Tell Computers and Humans Apart. There are many paid software in market which detect captcha code. The Tessaract.js library is used to identifying numbers from the text. Note: Its prediction is not 100% accurate however it can improve accuracy by using the str.replace(“”, “”) method. Only numeric captcha can be solved easily by using this method. Captcha 

Example: 

html




<!DOCTYPE html>
<html>
     
<head>
    <title>
        Auto captcha verification
    </title>
     
    <script src =
    </script>
</head>
 
<body>
    <img id = "img" src = "https://i.ibb.co/L97ShyB/download.jpg" />
     
    <div id = "GFG"></div>
     
    <!-- script for auto captcha verification -->
    <script>
        let progress = document.querySelector('#GFG');
         
        Tesseract.recognize('https://i.ibb.co/L97ShyB/download.jpg')
         
        .progress(function(p) {
            progress.innerHTML += JSON.stringify(p) + "<br>"
        })
         
        .then(function(result) {
            var captcha = result.text;
            alert(captcha)
        })
    </script>
</body>
 
</html>                   


Output:

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS