onJsAlert property
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onJsAlert', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)'), IOSPlatform(apiName: 'WKUIDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview'), MacOSPlatform(apiName: 'WKUIDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-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_ALERT dialog type.')])
final
Event fired when javascript calls the alert() method to display an alert dialog.
If JsAlertResponse.handledByClient is true, the webview will assume that the client will handle the dialog.
jsAlertRequest contains the message to be displayed in the alert dialog and the of the page requesting the dialog.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebChromeClient.onJsAlert)
- iOS WKWebView (Official API - WKUIDelegate.webView)
- macOS WKWebView (Official API - WKUIDelegate.webView)
- Linux WPE WebKit (Official API - WebKitWebView::script-dialog):
- Handles WEBKIT_SCRIPT_DIALOG_ALERT dialog type.
Parameters - Officially Supported Platforms/Implementations:
jsAlertRequest: all platforms
Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebChromeClient.onJsAlert',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)',
),
IOSPlatform(
apiName: 'WKUIDelegate.webView',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview',
),
MacOSPlatform(
apiName: 'WKUIDelegate.webView',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-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_ALERT dialog type.',
),
],
)
final FutureOr<JsAlertResponse?> Function(
T controller,
JsAlertRequest jsAlertRequest,
)?
onJsAlert;