shouldInterceptFetchRequest property
- @SupportedPlatforms.new(platforms: [AndroidPlatform(note: """In order to be able to listen this event, check the [InAppWebViewSettings.useShouldInterceptFetchRequest] setting documentation. Also, on Android that doesn't support the [WebViewFeature.DOCUMENT_START_SCRIPT], unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS. In that case, after the `window.addEventListener("flutterInAppWebViewPlatformReady")` event is dispatched, the ajax requests can be intercept for sure."""), IOSPlatform(), MacOSPlatform(), LinuxPlatform(note: 'This event is implemented using JavaScript. In order to be able to listen to this event, check the [InAppWebViewSettings.useShouldInterceptFetchRequest] setting documentation.')])
final
Event fired when a request is sent to a server through Fetch API. It gives the host application a chance to take control over the request before sending it. This event is implemented using JavaScript under the hood.
fetchRequest represents a resource request.
Officially Supported Platforms/Implementations:
- Android WebView:
- In order to be able to listen this event, check the InAppWebViewSettings.useShouldInterceptFetchRequest setting documentation. Also, on Android that doesn't support the WebViewFeature.DOCUMENT_START_SCRIPT, unlike iOS that has WKUserScript that can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS. In that case, after the
window.addEventListener("flutterInAppWebViewPlatformReady")event is dispatched, the ajax requests can be intercept for sure.
- In order to be able to listen this event, check the InAppWebViewSettings.useShouldInterceptFetchRequest setting documentation. Also, on Android that doesn't support the WebViewFeature.DOCUMENT_START_SCRIPT, unlike iOS that has WKUserScript that can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS. In that case, after the
- iOS WKWebView
- macOS WKWebView
- Linux WPE WebKit:
- This event is implemented using JavaScript. In order to be able to listen to this event, check the InAppWebViewSettings.useShouldInterceptFetchRequest setting documentation.
Parameters - Officially Supported Platforms/Implementations:
fetchRequest: all platforms
Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
note:
"""In order to be able to listen this event, check the [InAppWebViewSettings.useShouldInterceptFetchRequest] setting documentation.
Also, on Android that doesn't support the [WebViewFeature.DOCUMENT_START_SCRIPT], unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS.
In that case, after the `window.addEventListener("flutterInAppWebViewPlatformReady")` event is dispatched, the ajax requests can be intercept for sure.""",
),
IOSPlatform(),
MacOSPlatform(),
LinuxPlatform(
note:
'This event is implemented using JavaScript. In order to be able to listen to this event, check the [InAppWebViewSettings.useShouldInterceptFetchRequest] setting documentation.',
),
],
)
final FutureOr<FetchRequest?> Function(
T controller,
FetchRequest fetchRequest,
)?
shouldInterceptFetchRequest;