-
-
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
How to use event onLoadResourceCustomScheme #365
Comments
Here is an example. You need first declare what custom schemes you need to intercept using the initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
resourceCustomSchemes: ["my-special-custom-scheme"]
)
), Then, in the onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
if (scheme == "my-special-custom-scheme") {
var bytes = await rootBundle.load("test_assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
var response = CustomSchemeResponse(data: bytes.buffer.asUint8List(), contentType: "image/svg+xml", contentEnconding: "utf-8");
return response;
}
return null;
}, In my example, I'm simply reading an asset file from the In my test HTML I have: <img id="image" src="my-special-custom-scheme://images/flutter-logo.svg" alt="flutter logo"> that will be intercepted by the |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
Hi ,
I got stuck with onLoadResourceCustomScheme event , how to declare it in webview option ? and how to call to use it in event ?
The text was updated successfully, but these errors were encountered: