如何在WebView Flutter中允许mailto和tel URL方案? [英] How to allow mailto and tel URL schemes in WebView Flutter?
本文介绍了如何在WebView Flutter中允许mailto和tel URL方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Flutter中开发WebApp,但是当我单击找不到页面"上的tel:987654321
或mailto:
链接时,
要在移动设备中打开默认应用,我使用的是url_launcher依赖关系,但在后台单击WebView时,也运行相同的链接并转到未找到的页面.
I am developing WebApp in Flutter but when I click on tel:987654321
or mailto:
links going page Not Found,
To open the default app in mobile I am using url_launcher dependency But in the background when I click WebView also run the same link and go to page not found.
如何处理此任务?
推荐答案
navigationDelegate: (NavigationRequest request) {
if(request.url.contains("mailto:")) {
launch(request.url);
return NavigationDecision.prevent;
}
else if (request.url.contains("tel:")) {
launch(request.url);
return NavigationDecision.prevent;
}
},
这篇关于如何在WebView Flutter中允许mailto和tel URL方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文