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.

Example:
<!DOCTYPE html> <html> <head> <title> Auto captcha verification </title> <script src = </script> </head> <body> <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:

Recommended Posts:
- Nodejs | Automatic restart NodeJs server with nodemon
- Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript
- JavaScript Course | Understanding Code Structure in JavaScript
- JavaScript Course | Printing Hello World in JavaScript
- JavaScript Course | Conditional Operator in JavaScript
- JavaScript Course | Logical Operators in JavaScript
- JavaScript Course | Data Types in JavaScript
- JavaScript Course | Objects in JavaScript
- JavaScript Course | Functions in JavaScript
- JavaScript Course | Variables in JavaScript
- JavaScript Course | Loops in JavaScript
- JavaScript Course | JavaScript Prompt Example
- JavaScript Course | Operators in JavaScript
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- this in JavaScript
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




