开发者社区> 一叶飘舟> 正文

Getting net::ERR_UNKNOWN_URL_SCHEME while calling telephone number from HTML page in Android

简介:
+关注继续查看

I am getting "net::ERR_UNKNOWN_URL_SCHEME" while calling a telephone number option from an HTML page in Android. Do I need to add any permission(s) in the manifest to get this working? I haven't added anything in the manifest so far. Here's the HTML Code:

<a href="tel:+1800229933">Call us free!</a>

The following should work and not require any permissions in the manifest (basically override shouldOverrideUrlLoading and handle links separately from tel, mailto, etc.):

mWebView = (WebView) findViewById(R.id.web_view);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);

    mWebView.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if( url.startsWith("http:") || url.startsWith("https:") ) {
                return false;
            }

            // Otherwise allow the OS to handle things like tel, mailto, etc.
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity( intent );
            return true;
        }
    });
    mWebView.loadUrl(url);


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure frame ‘<URL>‘...
Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure frame ‘<URL>‘...
81 0
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
691 0
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
问题 今天遇到一个问题,Web 播放器在播放对象存储服务中的某个视频文件时,总是不断的报错 206(Partial Content),具体的信息如下: net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content) 造成的结果就是视频播放失败。 播放器报错截图如下:
909 0
if match header test - 428 Precondition required
Created by Wang, Jerry, last modified on Mar 25, 2015
49 0
where is os type and version determined for a ui5 html
Created by Jerry Wang, last modified on Jun 27, 2015
79 0
RN Exception: Failed to load http://localhost:8081/index.delta?platform=android&dev=true&minify=f...
异常 React Native调试时报如下错误 Failed to load http://localhost:8081/index.delta?platform=android&dev=true&minify=false: No 'Access-Co...
2510 0
iOS - 解决Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.
6148 0
错误:Mixed Content: The page at 'https://a.b.com/detail?id=5' was loaded over HTTPS, but reque
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/catoop/article/details/70247993 关于这个错误的详细内容为: Mixed Content: The page at 'https://a.
6465 0
Android--百度地图报错:at com.baidu.location.LocationClient.onStart(Unknown Source)
版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chaoyu168/article/details/70159731 在使用百度地图...
1817 0
+关注
一叶飘舟
文章
问答
视频
文章排行榜
最热
最新
相关电子书
更多
Apache Wicket User Guide - Ref
立即下载
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载