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 错误
238 0
|
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 问题
232 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
|
8月前
|
域名解析
访问 URL 报错 500 Internal Privoxy Error
访问 URL 报错 500 Internal Privoxy Error
357 0
|
缓存 前端开发 JavaScript
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
浏览器报错:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
1293 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>‘...
646 0
|
Web App开发 安全
Not allowed to navigate top frame to data URL
Not allowed to navigate top frame to data URL
267 0
|
存储 缓存 应用服务中间件
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
问题 今天遇到一个问题,Web 播放器在播放对象存储服务中的某个视频文件时,总是不断的报错 206(Partial Content),具体的信息如下: net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content) 造成的结果就是视频播放失败。 播放器报错截图如下:
1274 0
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
GM6 PageSet request didn&#39;t have target application url
GM6 PageSet request didn&#39;t have target application url
130 0
GM6 PageSet request didn&#39;t have target application url
|
前端开发 移动开发
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...
2746 0