<WebViewsource={{html: captchaHtml, // HTML string templatebaseUrl: 'https://ca.turing.captcha.qcloud.com' // Use Tencent Captcha domain name as baseUrl}}....// other necessary configuration/>
options={ready: function(size){// Communicate with Android}}new TencentCaptcha(appId, callback, options);
<!doctype html><html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Web Domain Name Switching Demo</title></head><body><div id="cap_frame"></div></body><script>// Maximum time to load scriptconst MAX_SCRIPT_LOAD_TIME = 10000;/*** load script promise* @param {object} config*/function loadScriptPromise(config) {return new Promise((resolve, reject) => {loadScript(config, (err, result) => {if (err) {reject(err);} else {resolve(result);}});});}/*** error callback* @param {string} captchaAppid*/function errorCallback(captchaAppid) {// error ticketconst ticket = `trerror_1001_${captchaAppid}_${Math.floor(new Date().getTime() / 1000)}`;const result = {ret: -1,randstr: `@${Math.random().toString(36).substr(2)}`,ticket,errorCode: 1001,errorMessage: 'jsload_error',};console.log(result);}/*** success callback* @param {object} result*/function globalCallback(result) {console.log(result);}/*** dynamic load script* @param {object} src timeout* @param {function} cb*/function loadScript({ src, timeout = MAX_SCRIPT_LOAD_TIME }, cb) {const startTime = Date.now();const script = document.createElement('script');script.async = true;script.src = src;let finished = false;const cleanup = () => {if (script.parentNode) {script.parentNode.removeChild(script);}script.onload = null;script.onerror = null;};const executeCallback = (err, result) => {if (finished) return;finished = true;clearTimeout(timer);cleanup();cb(err, result);};var timer = setTimeout(() => {executeCallback(new Error('Script load timeout'));}, timeout);script.onload = () => {const cost = Date.now() - startTime;executeCallback(null, cost);};script.onerror = () => {executeCallback(new Error('Script load error'));};document.head.appendChild(script);}/*** use captcha sdk* @param {string} appid*/function useCaptcha(appid) {const captcha = new TencentCaptcha(document.getElementById('cap_frame'),appid,globalCallback,{},);captcha.show();}/*** load captcha sdk* @param {string} appid*/async function loadCaptchaSDK(appid) {const MAX_SCRIPT_LOAD_TIME = 10000;const cdnUrls = ['https://ca.turing.captcha.qcloud.com/TJNCaptcha-global.js','https://www.tycaptcha.com/TJNCaptcha-global.js',];for (const [index, src] of cdnUrls.entries()) {try {console.log(`Trying Domain ${index + 1}: ${src}`);await loadScriptPromise({ src, timeout: MAX_SCRIPT_LOAD_TIME });console.log(`Domain ${index + 1} Load Success`);return useCaptcha(appid);} catch (error) {console.warn(`Domain ${index + 1} Load Failed:`, error.message);if (index === cdnUrls.length - 1) {console.error('All Domains Load Failed');return errorCallback(appid);}}}}loadCaptchaSDK('Yours CaptchaAppid').catch(console.error);</script></html>
Binary Bit | Major Category of Risk Control Interception Policy | Example |
0 | Second-level dial proxy IP address exception | EvilBitmap returns 34, which is converted to the binary value 100010. The first and fifth binary bits of it are 1, indicating the corresponding risk control interception policies are IP address short-term aggregation exception + Data parameter exception. |
1 | IP address short-term aggregation exception (multiple verifications in a short time) | |
2 | CaptchaAppId + IP address short-term aggregation exception (multiple verifications in a short time) | |
3 | CaptchaAppId + IP address + Device short-term aggregation exception (multiple verifications in a short time) | |
4 | Traffic feature exception (for example, TCP protocol stack information exception) | |
5 | Data parameter exception (for example, browser parameter exception) | |
6 | Honeypot exception (Execute the logic that should not be executed.) | |
7 | Behavior clustering exception | |
Code | Risk Type | Description |
101 | Comprehensive score risk | - |
102 | Simulate mouse trace risk | Suspected machine simulating mouse trace (applicable only to browser) |
201 | Malicious request risk | Suspected use of tools to initiate malicious requests. |
301 | Emulator risk | Suspected use of emulators |
401 | Device tampering risk | Suspected tampering of device hardware information. |
501 | Suspected black market risk | Suspected use of black and gray market devices. |
601 | Behavior risk | Suspected use of automated operations. |
701 | Browser risk | Suspected tampering of browsers. |
Feedback