onJsPrompt method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onJsPrompt', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)'), IOSPlatform(apiName: 'WKUIDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview'), MacOSPlatform(apiName: 'WKUIDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview')])
FutureOr<JsPromptResponse?>? onJsPrompt(
  1. JsPromptRequest jsPromptRequest
)

Event fired when javascript calls the prompt() method to display a prompt dialog. If JsPromptResponse.handledByClient is true, the webview will assume that the client will handle the dialog.

jsPromptRequest contains the message to be displayed in the prompt dialog, the default value displayed in the prompt dialog, and the of the page requesting the dialog.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • jsPromptRequest: all platforms

Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebChromeClient.onJsPrompt',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)',
    ),
    IOSPlatform(
      apiName: 'WKUIDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview',
    ),
    MacOSPlatform(
      apiName: 'WKUIDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview',
    ),
  ],
)
FutureOr<JsPromptResponse?>? onJsPrompt(JsPromptRequest jsPromptRequest) {
  return null;
}