In my app, i am using flutter inappwebview to load url, but i found out that mailto:,tel:,sms: url can not be loaded in the browser, i did my research and used the useShouldOverrideUrlLoading property in webview , but it do not seem to work.
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
),
android: AndroidInAppWebViewOptions(
forceDark:
Theme.of(context).brightness == Brightness.dark
? AndroidForceDark.FORCE_DARK_ON
: AndroidForceDark.FORCE_DARK_OFF,
useHybridComposition: widget.useHybridComposition,
),
),
shouldOverrideUrlLoading:
(InAppWebViewController controller,
NavigationAction shouldOverrideUrl) async {
print('this is an intercept');
Uri url = shouldOverrideUrl.request.url;
String action = url.scheme;
List<String> customActions = [
"http",
"https",
"file",
"chrome",
"data",
"javascript",
"about"
];
if (!customActions.contains(action)) {
if (await canLaunch(url.toString())) {
await launch(url.toString());
}
return NavigationActionPolicy.CANCEL;
}
return NavigationActionPolicy.ALLOW;
},
the version of flutter_inappwebview
flutter_inappwebview: ^5.4.3+7