简体   繁体   English

不希望电话链接在 brwsers 中呼叫只是电话

[英]Don't want telephone link to call out in brwsers just phones

I'm using because i have other numbers on the page that are not phone numbers and don't want them detected.我正在使用,因为我在页面上还有其他不是电话号码的号码,不希望它们被检测到。 I wrap the number in a link but I don't want it to be clickable in browsers, only on devices.我将数字包装在一个链接中,但我不希望它在浏览器中可点击,只能在设备上点击。

This is actually quite simple, Apple's documentation describes it quite thoroughly -这实际上很简单, Apple 的文档对其进行了非常彻底描述——

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

// Explicitly mark a number as a telephone number
<p>A phone number: <a href="tel:1-408-555-5555">1-408-555-5555</a></p>

To prevent the link doing anything when it's clicked on a desktop browser, you can do some browser sniffing...为了防止链接在桌面浏览器上单击时执行任何操作,您可以进行一些浏览器嗅探...

$('a.someClass').click(function(e) {
    if (!navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
        e.preventDefault();
    }
});

However, why would you want to cripple this functionality in desktop browsers in an age where the use of software such as Skype for VOIP is commonplace?但是,在使用 Skype 等 VOIP 等软件司空见惯的时代,您为什么要在桌面浏览器中削弱此功能? For an excellent discussion of why browser sniffing is a bad idea , see this question .有关为什么浏览器嗅探是个坏主意的精彩讨论,请参阅此问题

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

相关问题 如果我没有Bluetooth LE设备,那么我是否试图编写程序就很不走运? - If I don't have a Bluetooth LE device am I just out of luck with trying to write a program? MPMoviePlayerController不想工作 - MPMoviePlayerController don't want to work 我只是听不到AudioFileReadPackets - I just don't get AudioFileReadPackets 不想为UITableViewCell使用dequeueReusableCellWithIdentifier - don't want to use dequeueReusableCellWithIdentifier for UITableViewCell 在不使用 PushKit 和 CallKit 的情况下通知用户来电,因为它在中国已停用,我不想排除中国 Appstore - Notify users of incoming call without using PushKit and CallKit as it is deactivated in China and I don't want to exclude China Appstore 我的iOS应用程式仅能在其他手机无法安装的开发人员装置上运作(Phonegap) - My iOS app just working on my developer devices other phones can't install(Phonegap) 不想将内容放在UITableViewCell上 - Don't want to centre the content on UITableViewCell 为什么NSMutableDictionary不想写入文件? - Why NSMutableDictionary don't want write to file? NSDateFormatter:我不要时间! - NSDateFormatter: I Don't want the time! 对象不要称呼好的控制器 - Object don't call the good controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM