Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex SmartCaptcha
  • Getting started
    • Captcha accessibility
    • User validation
    • Domain validation
    • Challenge types
    • Challenge options
    • Widget integration methods
    • CAPTCHA keys
    • Invisible CAPTCHA
    • CAPTCHA in React
    • JavaScript Interface object
    • Restricted mode
    • Public IP addresses
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • JavaScript Interface structure
  • onGetToken(token: String): Unit method
  • onChallengeVisible(): Unit method
  • onChallengeHidden(): Unit method
  1. Concepts
  2. JavaScript Interface object

JavaScript Interface object

Written by
Yandex Cloud
Updated at January 20, 2025
View in Markdown
  • JavaScript Interface structure
    • onGetToken(token: String): Unit method
    • onChallengeVisible(): Unit method
    • onChallengeHidden(): Unit method

JavaScript Interface is an object Android transfers to WebView. The front end will then access this object to send messages using a callback function on Android.

JavaScript Interface structureJavaScript Interface structure

onGetToken(token: String): Unit methodonGetToken(token: String): Unit method

This is a required method, through which a token for passing CAPTCHA verification is transferred. It is called on the front end once the service has handled a user's attempt to pass CAPTCHA verification.

onChallengeVisible(): Unit methodonChallengeVisible(): Unit method

This is an optional method which you may only need to embed an invisible CAPTCHA. It is called when the invisible CAPTCHA shows a challenge to the user. By default, WebView with invisible CAPTCHA is hidden, so you need to track the moment when the WebView needs to be displayed.

onChallengeHidden(): Unit methodonChallengeHidden(): Unit method

This is an optional method which you may only need to embed an invisible CAPTCHA. If the user swiped CAPTCHA off, they cannot restore it on their own; you will need to show the previous screen to the user.

Note

When creating a class, the above methods are marked with the @JavascriptInterface annotation.
If you develop your own website with CAPTCHA, you can change the names of these methods. In this case, you will need to change the method names on the front-end side, too.

Was the article helpful?

Previous
CAPTCHA in React
Next
Restricted mode
© 2026 Direct Cursus Technology L.L.C.