-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add shouldInterceptRequest method #180
Comments
@TelephoneTan Thanks for your suggestion! I will add it to our feature plan. Feel free to submit a PR for it as well! |
Is there any progress on this feature? |
I am looking for this as well. Maybe I could help contribute this in? |
@jccr Sure, feel free to do it! |
Do you accept changes for Android only, or would every change need to support both ios and android? I have worked with implementing shouldInterceptRequest in react native |
Android WebView has a method called
shouldInterceptRequest
, it is used to support fully control over every request. We can use whatever we want as the response of the request by using this method.It's good to have such method or any similar feature.
Here is my use case with Android WebView's
shouldInterceptRequest
:I need to send some large messages(big image in base64 encoding, eg.) to js code, but the Android WebView has a maximum limit on the size of the data exchanged between js code and java code through the
@JavascriptInterface
(aka the js-bridge), so the ONLY way to achieve this is to make a "fake" HTTP request with a special url from js side, and "catch" this request in java side usingshouldInterceptRequest
, construct a HTTP response using the large message as the response body, and extract the large message from the HTTP response in js side later.By the way, according to SO, it seems that we can use
WKURLSchemeHandler
to implement an iOS version ofshouldInterceptRequest
method.The text was updated successfully, but these errors were encountered: