-
-
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 open to new schema? #188
Comments
<img src="my-special-custom-scheme://images/flutter-logo.svg" alt="flutter logo"> So, in the initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
resourceCustomSchemes: ["my-special-custom-scheme"],
)
) and the event handler could be something like this: onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
if (scheme == "my-special-custom-scheme") {
var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
var response = new CustomSchemeResponse(bytes.buffer.asUint8List(), "image/svg+xml", contentEnconding: "utf-8");
return response;
}
return null;
}, Instead, in your case you want to handle custom schemes that are not about resources like images, etc. So, in this case, you need to set the shouldOverrideUrlLoading: (InAppWebViewController controller, String url) {
if (url.startsWith("whatsapp://")) {
// Open WhatsApp app
} else if (url.startsWith("foo://")) {
// check for other apps ...
}
}, If you want to open an app like WhatsApp, you can use my other plugin flutter_appavailability. However, you are using the 2.0 flutter_inappbrowser version that is not published yet. I need to finish the new documentation and create at least some tests before publishing it. Of course, you can use it at your own risk for now. |
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. |
I use addthis plugin inside webview, when click share to social media will hit net:ERR_UNKNOWN_URL_SCHEME
i'm add these to my code still not working
Is any where can fixed this? Thank you
The text was updated successfully, but these errors were encountered: