onJsPrompt property
- @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'), LinuxPlatform(apiName: 'WebKitWebView::script-dialog', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.script-dialog.html', note: 'Handles WEBKIT_SCRIPT_DIALOG_PROMPT dialog type.')])
final
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:
- Android WebView (Official API - WebChromeClient.onJsPrompt)
- iOS WKWebView (Official API - WKUIDelegate.webView)
- macOS WKWebView (Official API - WKUIDelegate.webView)
- Linux WPE WebKit (Official API - WebKitWebView::script-dialog):
- Handles WEBKIT_SCRIPT_DIALOG_PROMPT dialog type.
Parameters - Officially Supported Platforms/Implementations:
jsPromptRequest: all platforms
Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property 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',
),
LinuxPlatform(
apiName: 'WebKitWebView::script-dialog',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.script-dialog.html',
note: 'Handles WEBKIT_SCRIPT_DIALOG_PROMPT dialog type.',
),
],
)
final FutureOr<JsPromptResponse?> Function(
T controller,
JsPromptRequest jsPromptRequest,
)?
onJsPrompt;