-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shouldInterceptRequest Method Not Working on iOS - Need Alternative Solution #2507
Comments
I don't think it's a bug. iOS WKWebView just doesn't support it. |
The funny thing is that |
onLoadResource is natively supported on iOS. However, it is implemented via js on Android, you can check this: Lines 30 to 48 in 0aaf7a0
As I tested on my pc using same method, it catches all network activities. |
If your webview is released after November 29, 2023, it should support addDocumentStartJavaScript. Check it via developer tools. |
My advice is you can use both onLoadResource and shouldInterceptRequest if you mean to get the network requests other than block them. |
Is there an existing issue for this?
Current Behavior
The
shouldInterceptRequest
method only works on Android platforms. When attempting to intercept media URLs on iOS, this method does not functionExpected Behavior
Ideally,
shouldInterceptRequest
should work consistently across both Android and iOS platforms, providing a unified way to intercept network requests, particularly for media URL detection.Steps with code example to reproduce
Stacktrace/Logs
nothing
Flutter version
3.27.2
Operating System, Device-specific and/or Tool
macos; 3.27.2
Plugin version
6.1.5
Additional information
Currently trying to intercept background requests on iOS is challenging as shouldInterceptRequest only works on Android. While combining onLoadResource,
shouldInterceptAjaxRequest
, andshouldInterceptFetchRequest
provides partial coverage, some requests might still be missed.Could you suggest any other iOS-specific solutions or methods to reliably intercept all background requests? Perhaps there are iOS WebKit capabilities or alternative approaches that could be implemented to provide functionality similar to Android's
shouldInterceptRequest
?Looking forward to your guidance on the best approach for iOS request interception.
Self grab
The text was updated successfully, but these errors were encountered: