JavaScriptBridge

Executes JavaScript against the current page and installs scripts that should run before the page's own JavaScript.

Platform implementations map this API to the native WebView bridge:

  • Android uses WebView.evaluateJavascript and AndroidX WebKit document-start scripts.

  • iOS and macOS use WebKit user scripts injected at document start.

  • Desktop/JVM forwards calls to the native backend through WebViewBridgePanel.

Functions

Link copied to clipboard
abstract suspend fun evaluateScript(script: String): String?

Evaluates script in the current page context.

Link copied to clipboard
abstract suspend fun registerDocumentStartHook(script: String): CloseHandle

Registers script so it runs at document start for future page loads.

Link copied to clipboard

Registers a native web-message handler for the current platform.