Simple JavaScript Captcha Example (Client Side Captcha)
https://jharaphula.com/simple-javascript-captcha-example/
Simple JavaScript Captcha Example (Client Side Captcha)
JAVASCRIPT FUNCTIONS & EXAMPLES May 14, 2016 5 (2 votes)
Captcha is a technique to protect web forms from auto submission. Validating Captcha proofs that the user is a human. Today inside this growing network many hackers are sitting around the world. They have several tools to hack. Let’s talk about a simple login form. In a login form basically we have 2 input fields (username & password) with 1 submit button. To hack if we will pass random strings to username & password using a program there can be a chance in some point of time submit will successful. While manually it is quite difficult. That’s why JavaScript Captcha.
Captcha is generating a code in the format of an image or string. User need to provide Captcha code before submitting a form. Here my intention to tell you adding Captcha reduce the chance of unnatural form submissions. Captcha can be created at both the end server or client side. In this example I created a Simple JavaScript Captcha. Client side Captcha helps to reduce http requests. It gives better performance.
In the below code using math class I am generating 7 numeric characters randomly. Concatenating them with space in-between. Then assigning this value to txtCaptcha value. While user entering the text to txtCaptcha I am comparing these two values. If it is equal I am returning true else false.
Simple JavaScript Captcha
|
Last updated