onCloseWindow property
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onCloseWindow', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)'), IOSPlatform(apiName: 'WKUIDelegate.webViewDidClose', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose'), MacOSPlatform(apiName: 'WKUIDelegate.webViewDidClose', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose'), WebPlatform(), WindowsPlatform(apiName: 'ICoreWebView2.add_WindowCloseRequested', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#add_windowcloserequested'), LinuxPlatform(apiName: 'WebKitWebView::close', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.close.html')])
final
Event fired when the host application should close the given WebView and remove it from the view system if necessary. At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebChromeClient.onCloseWindow)
- iOS WKWebView (Official API - WKUIDelegate.webViewDidClose)
- macOS WKWebView (Official API - WKUIDelegate.webViewDidClose)
- Web <iframe> but requires same origin
- Windows WebView2 (Official API - ICoreWebView2.add_WindowCloseRequested)
- Linux WPE WebKit (Official API - WebKitWebView::close)
Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebChromeClient.onCloseWindow',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)',
),
IOSPlatform(
apiName: 'WKUIDelegate.webViewDidClose',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose',
),
MacOSPlatform(
apiName: 'WKUIDelegate.webViewDidClose',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose',
),
WebPlatform(),
WindowsPlatform(
apiName: 'ICoreWebView2.add_WindowCloseRequested',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#add_windowcloserequested',
),
LinuxPlatform(
apiName: 'WebKitWebView::close',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.close.html',
),
],
)
final void Function(T controller)? onCloseWindow;