You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Shazron Abdullah (JIRA)" <ji...@apache.org> on 2012/08/08 21:38:21 UTC

[jira] [Resolved] (CB-1213) Calling phone numbers with the tel: URI scheme from JS doesn't work

     [ https://issues.apache.org/jira/browse/CB-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shazron Abdullah resolved CB-1213.
----------------------------------

    Resolution: Won't Fix

Adding for knowledge base purpose.

Workaround: Load it through an anchor tag (create it dynamically, and 
programmatically click it). 

This is because when we encounter a "tel:" uri we pass it off to the 
underlying UIWebView handler, and it should pop up the call dialog. 
When an anchor tag is used, it is of navigation type 
"UIWebViewNavigationTypeLinkClicked" which is handled properly -- but 
when it is called from "window.location", it is 
"UIWebViewNavigationTypeOther". 

If we took out our delegate handler, and relied on the default 
UIWebView handler (none of our processing), it will exhibit the same 
behaviour that you are seeing. Thus, it is not a Cordova issue. 
                
> Calling phone numbers with the tel: URI scheme from JS doesn't work 
> --------------------------------------------------------------------
>
>                 Key: CB-1213
>                 URL: https://issues.apache.org/jira/browse/CB-1213
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: Master
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>
> Discussion: https://groups.google.com/d/topic/phonegap/w2E7WOnhgiw/discussion
> Calling phones from Javascript (using window.location) and the tel: URI scheme doesn't seem to be working on iPhone devices with apps packaged by PhoneGap Build, so the issue must be in the PhoneGap framework.
> They work alright when the app is loaded as a web app through Safari, but when it runs as a native app (where the phonegap.js file is loaded), they don't work anymore, no errors or alerts are displayed, it just doesn't do anything.
> Here's the code I use:
> function CallPhone(sPhoneNumber){
> sPhoneNumber = sPhoneNumber.replace(/[^0-9]/g, "");
> window.location = "tel:" + sPhoneNumber;
> };
> To try it out, just call the function when a button or link is clicked. I'm using Sencha Touch v2 to develop the app. You can also try changing the URI scheme to be "tel://" instead of just "tel:" but it will not work also. I'd like to reiterate that this code works perfectly when opening the app through Safari from a URL I uploaded the app to, but not when running it as a packaged PhoneGap app (using PhoneGap Build).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira