javascript - Using tel: Hyperlinks on Android < 4 alternative? -


i have app gives normal landline numbers uk 08 numbers.

currently web page shown in app, when user finds number want , click on green phone icon. i'm using following javascript force force tel: link number bring dailer.

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

this method works fine newer android 4.0 , above far can see. when use old orange san francisco phone (android 2.3) doesnt bring dailer. instead attempts open new page tel:01xxxxxxxx url in turn displays web page not available message.

i assume because tel: part of html5 why it's not working. there alternative work on versions?

tel: preferred - since 1990's. callto: may work better devices. see also: how mark-up phone numbers?

edit

since have page running inside android webview, can handle error hack (also described @ 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 may need permission

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

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -