JSEcoin Captcha

Website Cryptocurrency Mining

JSEcoin Captcha

July 18, 2019 Announcements Code Development News Publishers 0

The JSE Captcha is a free to use bot prevention tool. It can be used to protect content and endpoints from automated requests.

For the latest docs and updates please visit: https://developer.jsecoin.com

Setting up the captcha requires two parts, a code snippet on the web page and then a server-side verification check. A simple div element is placed in the HTML code for the web page. Standard CSS can be used to position as required. Then a external javascript call loads the code and renders the captcha inside the div.

Basic Client-Side Example (With Auto Center CSS)

The following example uses a inline css style tag to set center the captcha inside it’s container. The style tag is not required but can be used to customise the captcha’s placement as required.

<div id=”JSE-captcha” style=”margin: 0px auto;”></div><script type=”text/javascript” src=”https://api.jsecoin.com/captcha/load/captcha.js”></script>

Server-side Verification

It is essential to check the captcha has been completed using server-side code to protect your endpoints. We do this using the clients IP address (IPV4) and the following URL:


Example JSON responses:

{"success":1,"rating":0,"pass":false,"knownIP":false, "ip":""}

{"success":1,"rating":87,"pass":true,"knownIP":true, "ip":""}

Optional Javascript Check Function

It is also possible to run a javascript check to see if the captcha has been completed. This can be useful from a UX perspective before submitting a form for example but should not be used for security purposes.

The example below calls the JSECaptchaComplete function which is available globally and then fires the function name that is passed to it. In this example customFunction(); is called on the button click if the captcha has been completed. If not the captcha will simply flicker red a few times to prompt the user.

<button onclick=”JSECaptchaComplete(‘customFunction’);”>Login</button>

Optional Javascript Event Notification

An event will be fired on completion of the captcha, this can be acted upon by setting up an event listener for “JSECaptchaPass”. See example code below.

document.addEventListener("JSECaptchaPass", function(e) {
  console.log('Captcha completed by '+e.ip);
}, false);
Optional Customisation CSS

There are a number of built in custom CSS modes including dark mode, large size, and shadow border. These can be used by simply adding a class name to the main JSE-captcha div code. See example below where they are combined. Additional custom styling can be made to the code by adding CSS to the relevant elements.

<div id="JSE-captcha" class="JSE-captcha-dark JSE-captcha-large JSE-captcha-shadow"></div>
<script type="text/javascript" src="https://api.jsecoin.com/captcha/load/captcha.js"></script>

For the latest docs and updates please visit: https://developer.jsecoin.com