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);


相关文章
|
6月前
|
API Android开发 数据安全/隐私保护
解决android webview 加载http url 失败 net::ERR_CLEARTEXT_NOT_PERMITTED 错误
解决android webview 加载http url 失败 net::ERR_CLEARTEXT_NOT_PERMITTED 错误
225 0
|
5天前
|
缓存 JavaScript
报错:cannot read properties of undefined “reading url“
报错:cannot read properties of undefined “reading url“
|
8月前
|
Web App开发 JavaScript 前端开发
解决DevTools failed to load SourceMap Could not load content for .js.map HTTP error code 404 问题
解决DevTools failed to load SourceMap Could not load content for .js.map HTTP error code 404 问题
221 0
|
4月前
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
|
6月前
Android-async-http 添加token get方法报错 No valid URI scheme was provided
Android-async-http 添加token get方法报错 No valid URI scheme was provided
|
8月前
|
域名解析
访问 URL 报错 500 Internal Privoxy Error
访问 URL 报错 500 Internal Privoxy Error
341 0
|
缓存 前端开发 JavaScript
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
1289 0
|
11月前
|
JavaScript 网络安全
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>‘...
640 0
|
存储 缓存 应用服务中间件
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
问题 今天遇到一个问题,Web 播放器在播放对象存储服务中的某个视频文件时,总是不断的报错 206(Partial Content),具体的信息如下: net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content) 造成的结果就是视频播放失败。 播放器报错截图如下:
1271 0
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
How is navigation target url request handled by backend
How is navigation target url request handled by backend
146 0
How is navigation target url request handled by backend