vanreus
vanreus

Reputation: 183

Phone Number Link Detection on Mobile Device

I am creating a native app for iOS with Jquery Mobile and Phonegap. Within the app, I dynamically load data with ajax. Some of the included data are strings of numbers that automatically add a tel: link to the span containing the string. I need to remove the link from being assigned to it. I have tried adding <meta name="format-detection" content="telephone=no" /> to the head and tried adding x-apple-data-detectors="false" to the span. Neither have worked. Any help is appreciated.

Upvotes: 1

Views: 871

Answers (2)

Scott
Scott

Reputation: 21501

You can add this meta header to your page, to prevent it automatically creating the tel: links

<meta name="format-detection" content="telephone=no" />

See the Safari documentation here

Upvotes: 4

Noogen
Noogen

Reputation: 1652

Add meta tag to your html and add code inside of webViewDidStartLoad method in iOS MainViewController.m

(void) webViewDidStartLoad:(UIWebView*)theWebView
{

    // disable telephone detection, basically <meta name="format-detection" content="telephone=no" />
    theWebView.dataDetectorTypes = UIDataDetectorTypeAll & !UIDataDetectorTypePhoneNumber;
    return [super webViewDidStartLoad:theWebView];
}

Upvotes: -1

Related Questions