wap页面中手机号码处理总结

1、防止在iOS设备中的Safari将数字识别为电话号码

在測试中发现iPad上的Safari总会把长串数字识别为电话号码,文字变成蓝色。点击还会弹出菜单加入到通讯录。



别的地方倒也罢了。假设在username中出现数字(手机注冊新浪微博的话username就是“手机用户xxxxxxxx”),版式会非常恶心。



经过測试在a标签中的长串数字不会识别为电话,于是给出现username但没有链接的地方嵌套一个无动作的a标签,暂时攻克了这个问题。



可是这样添加了额外的标签。代码的语义性变得非常差,并且对大段文字不能用这种方法。

今天无意中撞进Safari的官网,发现了safari有个私有meta属性能够解决问题:

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

官网的说明例如以下: How do I disable automatic detection of phone numbers in webpages? In Safari on iPhone, phone numbers are automatically detected and transformed into links that dial the phone number when tapped. If you have strings of numbers in your webpage that should not be automatically detected as phone numbers, you can choose to disable this feature on the entire page by adding the meta tag shown in Listing 12.


2、点击拨打

<a href="tel:电话号码">电话号码</a>


3、自己定义被识别的手机号码

被识别后也就是自己主动加了超链接,通过子级选择器定义a标签就可以


<div class="content">手机:1300000000</div>

.content a{color:#000;}


转载于:https://www.cnblogs.com/jzdwajue/p/7098630.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值