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

时间:2013-06-18 15:54:35

标签: javascript jquery ios jquery-mobile cordova

我正在使用Jquery Mobile和Phonegap为iOS创建原生应用。在应用程序中,我使用ajax动态加载数据。一些包含的数据是自动添加tel:link到包含字符串的span的数字字符串。我需要删除分配给它的链接。我尝试在头部添加<meta name="format-detection" content="telephone=no" />并尝试在跨度中添加x-apple-data-detectors =“false”。两者都没有奏效。任何帮助表示赞赏。

2 个答案:

答案 0 :(得分:4)

您可以将此元标题添加到您的网页,以防止它自动创建tel:链接

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

查看Safari documentation here

答案 1 :(得分:-1)

在你的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];
}
相关问题