onNavigationResponse method
- @SupportedPlatforms.new(platforms: [IOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview'), MacOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview')])
Called when a web view asks for permission to navigate to new content after the response to the navigation request is known.
navigationResponse represents the navigation response.
NOTE: In order to be able to listen this event, check the InAppWebViewSettings.useOnNavigationResponse setting documentation.
Officially Supported Platforms/Implementations:
- iOS WKWebView (Official API - WKNavigationDelegate.webView)
- macOS WKWebView (Official API - WKNavigationDelegate.webView)
Parameters - Officially Supported Platforms/Implementations:
navigationResponse: all platforms
Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
IOSPlatform(
apiName: 'WKNavigationDelegate.webView',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview',
),
MacOSPlatform(
apiName: 'WKNavigationDelegate.webView',
apiUrl:
'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview',
),
],
)
FutureOr<NavigationResponseAction?>? onNavigationResponse(
NavigationResponse navigationResponse,
) {
return null;
}