Disable telephone anchor

57 views
Skip to first unread message

Diogo Cardoso

unread,
May 18, 2012, 6:15:41 PM5/18/12
to phon...@googlegroups.com

I'm developing a web application using PhoneGap that will be distributed to several mobile OS including iOS.

When I generate the application to iOS the numeric values with at least 7 digits are modified to telephone anchors, in order to "fix" this I've attached the following event handler:

$( 'a[href^="tel"]' ).live( 'click', function() {
   
return false;
});

This code works fine except when I use jQuery Mobile, any idea why?

ericcxu

unread,
May 18, 2012, 6:20:45 PM5/18/12
to phonegap
I did the same thing in the native way. It seemed to work fine.
Add
theWebView.dataDetectorTypes = UIDataDetectorTypeNone;
to
- (void)webViewDidStartLoad:(UIWebView *)theWebView

Eric
Message has been deleted

Diogo Cardoso

unread,
May 18, 2012, 6:23:35 PM5/18/12
to phon...@googlegroups.com
I'm using PhoneGap Build and I would like to continue to use it if possible :) 

ericcxu

unread,
May 18, 2012, 6:25:13 PM5/18/12
to phonegap
I'm using phonegap 1.6.1. You can modify the native code.

Diogo Cardoso

unread,
May 18, 2012, 6:43:16 PM5/18/12
to phon...@googlegroups.com
I'm not fully understanding the solution, could you please explain yourself a little better?

The only process that I do when deploying the application is to build it on PhoneGap Build and install it on the mobile device.

ericcxu

unread,
May 18, 2012, 6:54:00 PM5/18/12
to phonegap
If you are running cordova 1.5+, in your xcode project, there're
AppDelegate.m/h and MainViewController.m/h. In MainViewController.m,
add the following lines

- (void)webViewDidStartLoad:(UIWebView *)theWebView
{
// disable telephone detection, basically <meta name="format-
detection" content="telephone=no" />
theWebView.dataDetectorTypes = UIDataDetectorTypeNone; //
UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;

return [super webViewDidStartLoad:theWebView ];
}

Eric
Reply all
Reply to author
Forward
0 new messages