iOS中的嵌套锚标签

时间:2015-07-06 19:28:11

标签: html ios anchor

我正在建立一个移动菜单,我有一个指向联系人部分的链接:

<a class="global-navigation__chat">
    <span data-icon="chat"></span>
    <div class="nav-hidden-text">
        <span><?php print t('Chat With Sales'); ?></span>
        <span>+1 111 111 1111</span>
    </div>
</a>

问题是iOS似乎将电话号码转换为锚标记,因此违反了嵌套锚定规则。当我在手机上查看页面时,锚标记位于前面的锚标记之后:

<div class="nav-hidden-text">
<a class="global-navigation__chat">
    <span data-icon="chat"></span>      
        <span><?php print t('Chat With Sales'); ?></span>
</a>
</div>

<a href="tel:+1 111 111 1111">+1 111 111 1111</a>

这是预期的iOS行为吗?我是否必须重写我的HTML以便电话号码没有锚包装器?

1 个答案:

答案 0 :(得分:0)

如果您正在创建在移动版Safari中运行的网络应用/网站,则可以使用

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

像提到here一样禁用数字检测。

如果您正在使用UIWebView创建iOS应用程序,则可以在Interface Builder / Storyboard中的WebView的Attribute Inspector中禁用自动数字检测,或者使用

进行编程
webView.dataDetectorTypes = UIDataDetectorTypes.None

完全没有检测到。

相关问题