简体   繁体   English

移动设备上的电话号码链路检测

[英]Phone Number Link Detection on Mobile Device

I am creating a native app for iOS with Jquery Mobile and Phonegap. 我正在使用Jquery Mobile和Phonegap为iOS创建本机应用程序。 Within the app, I dynamically load data with ajax. 在应用程序中,我使用ajax动态加载数据。 Some of the included data are strings of numbers that automatically add a tel: link to the span containing the string. 一些包含的数据是自动添加tel:link到包含字符串的span的数字字符串。 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. 我尝试将<meta name="format-detection" content="telephone=no" />添加到头部并尝试将x-apple-data-detectors =“false”添加到跨度中。 Neither have worked. 两者都没有奏效。 Any help is appreciated. 任何帮助表示赞赏。

You can add this meta header to your page, to prevent it automatically creating the tel: links 您可以将此元标题添加到您的页面,以防止它自动创建tel:链接

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

See the Safari documentation here 请在此处查看Safari 文档

Add meta tag to your html and add code inside of webViewDidStartLoad method in iOS MainViewController.m 将元标记添加到您的html并在iOS MainViewController.m中的webViewDidStartLoad方法中添加代码

(void) webViewDidStartLoad:(UIWebView*)theWebView
{

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM