Using tel: Hyperlinks on Android < 4 alternative?

I have an app which gives normal landline numbers for UK 08 numbers.

Currently this is a web page shown in the app, when the user finds the number they want and click on the green phone icon. I'm using the following JavaScript to force then force a tel: link with the number to bring up the dailer.

document.location.href = 'tel:'+number;//push browser to call number

This method works fine for all newer android 4.0 and above as far as i can see. But when i use my old Orange San Francisco Phone (android 2.3) it doesnt bring the dailer. Instead it just attempts to open a new page with tel:01xxxxxxxx as the URL which in turn displays a web page not available message.

I assume this is because tel: is part of HTML5 which is why it's not working. Is there any alternative that would work on all versions?

Answers


tel: is preferred - since the 1990's. callto: may work better for some devices. See also: How to mark-up phone numbers?

EDIT

Since you have the page running inside an Android WebView, you can handle this error with the hack (also described at Android WebView "tel:" links show web page not found):

myWebView.setWebViewClient(new WebViewClient() {  
    @Override  
    public boolean shouldOverrideUrlLoading(WebView view, String url) {  
        if (url.startsWith("tel:")) { 
            Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url)); 
            startActivity(intent); 
        }
        else if(url.startsWith("http:") || url.startsWith("https:")) {
            view.loadUrl(url);
        }
        return true;  
    }  
} 

For which you may need the permission

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

Need Your Help

How to Convert C# Linq to VB.NET

c# vb.net linq

can someone help me convert this C# Linq-u to a VB.NET code

I am getting (lat,long) coordinates in phonegap geolocation without using internet or GPS ?

cordova geolocation w3c-geolocation

When i tried out a sample program in phonegap geolocation. I am getting the latitude and longitude of my current location without internet or GPS in my samsung pop. I don't know how it is getting the