Stay organized with collections
Save and categorize content based on your preferences.
JavascriptInterface
@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) class JavascriptInterface
Annotation that allows exposing methods to JavaScript. Starting from API level android.os.Build.VERSION_CODES#JELLY_BEAN_MR1
and above, only methods explicitly marked with this annotation are available to the Javascript code. See android.webkit.WebView#addJavascriptInterface
for more information about it.
Summary
Public constructors |
Annotation that allows exposing methods to JavaScript.
|
Public constructors
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# JavascriptInterface\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nJavascriptInterface\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/webkit/JavascriptInterface \"View this page in Java\") \n\n```\n@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) class JavascriptInterface\n```\n\n|-----------------------------------------|\n| [android.webkit.JavascriptInterface](#) |\n\nAnnotation that allows exposing methods to JavaScript. Starting from API level [android.os.Build.VERSION_CODES#JELLY_BEAN_MR1](../os/Build.VERSION_CODES.html#JELLY_BEAN_MR1:kotlin.Int) and above, only methods explicitly marked with this annotation are available to the Javascript code. See [android.webkit.WebView#addJavascriptInterface](/reference/kotlin/android/webkit/WebView#addJavascriptInterface(kotlin.Any,%20kotlin.String)) for more information about it.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------|---|\n| [JavascriptInterface](#JavascriptInterface())`()` Annotation that allows exposing methods to JavaScript. |\n\nPublic constructors\n-------------------\n\n### JavascriptInterface\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nJavascriptInterface()\n```\n\nAnnotation that allows exposing methods to JavaScript. Starting from API level [android.os.Build.VERSION_CODES#JELLY_BEAN_MR1](../os/Build.VERSION_CODES.html#JELLY_BEAN_MR1:kotlin.Int) and above, only methods explicitly marked with this annotation are available to the Javascript code. See [android.webkit.WebView#addJavascriptInterface](/reference/kotlin/android/webkit/WebView#addJavascriptInterface(kotlin.Any,%20kotlin.String)) for more information about it."]]