如何使< a href>仅在移动设备上有效? [英] How can I make an <a href> only active on mobile devices?
本文介绍了如何使< a href>仅在移动设备上有效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想添加此代码,以使我的网站上的联系人详情在点击时自动跳转到移动拨号盘/通讯录:
I want to add this code to make the contact details on my website automatically jump into a mobile dialpad/address book when clicked:
<a href="tel:12345555555">Call Us Now</a>
如何让非电话设备(计算机,平板电脑,笔记本电脑)以便不会返回404错误,并且无法点击?
How can I make it appear as plain text for non-telephone devices (computers, tablets, laptops) so that it doesn't return a 404 error and cannot be clicked?
很高兴使用HTML / CSS / JS的任意组合来实现此功能。
Happy to use any combination of HTML/CSS/JS to achieve this.
推荐答案
不要使用超链接。使用微数据。手机会识别这是一个电话号码,允许点击,但不会影响正常的网络浏览器。
Don't use a hyperlink. Use microdata. Mobile phones will recognize that it is a phone number and allow it to be clicked but it won't affect normal web browsers.
<div class="vcard">
<div class="tel">
12345555555
</div>
</div>
这篇关于如何使< a href>仅在移动设备上有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文