通过网页跳转至App页面时,报错 “找不到网页, net::ERR_UNKOWN_URL_SCHEME”
解决方案:
webview.setWebViewClient(new WebViewClient(){
// 如果应用程序想要离开当前WebView并处理url本身,则返回true,否则返回false。
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// 以"http","https"开头的url在本页用webview进行加载,其他链接进行跳转
if( url.startsWith("http:") || url.startsWith("https:") ) {
return false;
}
Intent intent = new Intent();
intent.setData(Uri.parse(url));
startActivity(intent);
//如果不需要其他对点击链接事件的处理返回true,否则返回false
return true;
}
})