Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CAPTCHA validation with JavaScript

I am trying to validate Captcha using JavaScript. But I could't find any resource about Client API's of Captcha. Do you have any documentation?

like image 813
vasanth Avatar asked Jul 11 '26 00:07

vasanth


2 Answers

If you could validate the captcha through JavaScript that would mean the means of finding out the valid code would be readily available in the code that you're passing to the client, which would effectively invalidate the use for a captcha altogether.

The only secure way to achieve this would be to send an AJAX request to the server, which would then validate the code. This way, your validation would be done exactly the way you normally validate the captcha on the server.

like image 199
David Hedlund Avatar answered Jul 13 '26 12:07

David Hedlund


Validating a captcha with javascript would mean that you would need to have some representation of your captcha text visible in your html source, which is automatically visible to a bot.

I think a possibility if you absolutely have to validate using javascript would be to hash your captcha text server side, load it in a javascript variable, and then validate using the equivalent javascript hashing function.

like image 27
Eric Conner Avatar answered Jul 13 '26 14:07

Eric Conner