I have a webview that I am creating. It seems to automatically be linkifying numbers into tel: urls. I didn\'t see a way to remove this ability (at least nothing similar t
There is a way to do that - rather ugly, two layered, but still a workaround.
You should
explicitly tell the loaded page not to apply styles and haptic feedback.
mWebView.setWebViewClient( new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url) {
Uri uri = Uri.parse(url);
//TODO analyse the uri here
//and exclude phone and email from triggering any action
return false;
}
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {}
public void onPageFinished (WebView view, String url) {...}
public void onPageStarted(WebView view, String url, Bitmap favicon) {...}
public void onLoadResource(WebView view, String url) {...}
});
In the html specify the following meta tags inside the tag:
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
Hope this helps.
I'm surprised to see it is launching Dialer on selecting a number from your own WebView.
Unless, you override WebViewClient::shouldOverrideUrlLoading() and detect the url scheme has "tel" and start Dialer activity, it will never launch a Dialer from your WebView. Are you sure you are not handling tel: scheme in shouldOverrideUrlLoading()?
You can find the code that do the real detection in external
/webkit
/WebKit
/android
/nav
/CacheBuilder.cpp
: FindPartialNumber()
and so on.
You can disable it or change the logic as you like.