Overview
When you have integrated server SDK and run the demo, a simplified version of captcha has already been integrated. We also provide other configuration parameters and APIs except the demo presented. This session will explain the configuration and APIs of client.
Development environment
Item | Description |
---|---|
Compatibility | IE 6+, Chrome, Firefox, Safari, Opera, mainstream mobile browsers and Webview of iOS and Android |
Resources
Item | Link |
---|---|
Data communication flow chart | Data communication flow chart |
API documentation | API example |
Note:Note: if there are restrictions on domain names, please add the following domain names to your release list(*.geetest.com,*.geevisit.com,*.gsensebot.com).
Installation
Prerequisite: Please ensure that you have finished the server integration (Server integration docs)
- Import captcha initialization function
initGeetest
through the following example.(Download gt.js to your local and integrate it into your project: https://static.geetest.com/static/js/gt.0.4.9.js)
<script src="./gt.0.4.9.js"></script> |
The captcha initialization should be finished after the web page has been loaded. Otherwise, the captcha cannot collect the behavioral data in this web page, which will lead to the failure of some defense strategies.
Note: the gt.js
is used to load the corresponding JS libraries.
Initialization
ajax({
url: "API1 url(Refer to server integration docs)",
type: "get",
dataType: "json",
success: function (data) {
//Ensure data.gt, data.challenge and data.success are not null
initGeetest({
// The following data are from server side
gt: data.gt,
challenge: data.challenge,
offline: !data.success,
new_captcha: true
}, function (captchaObj) {
// Call instance method captchaObj
})
}
})
Note: For multiple CAPTCHAs on the same page, each CAPTCHA requires initilization from calling initGeeTest() method.
Configuration
The parameter configuration refers to the config
object (key-value pairs) which is passed during the captcha verification. It is the first parameter passed when calling the initGeetest()
.
The following parameters are required to be configured.
Parameter | Type | Description |
---|---|---|
gt |
String | CAPTCHA ID. You can get it from the dashboard. |
challenge |
String | ID of CAPTCHA request, generated when server SDK sends a request to GeeTest server. |
offline |
Boolean | Status of GeeTest API server, which indicates whether GeeTest server is uptime or downtime (i.e. in Failback mode) |
new_captcha |
Boolean | Refers to the CAPTCHA version (V3.0 or V2.0) and could be used in Failback mode. The return value true refers to V3.0. |
You only need to pass these parameters which are returned from server SDK as shown in the Demo.
Please check the API referer for the optional configuration parameters.