【问题标题】:How to stop "tel:number" links from working on desktop / tablets如何阻止“电话:号码”链接在台式机/平板电脑上工作
【发布时间】:2015-04-12 12:57:58
【问题描述】:

这一定很常见......我很抱歉,但在这里找不到有效的解决方案......

我正在开发一个网站(改造),它具有响应式 CSS,例如:

/* Refecence from responsive.css
/* crank up to 5000px to support high res monitors and TV's */
@media only screen and (min-width: 1200px) and (max-width: 5000px) 
/* Portrait tablet to landscape and desktop - BROWSER SIZE 2 */
@media only screen and (min-width: 991px) and (max-width: 1200px) 
/* Landscape phone to portrait tablet - BROWSER SIZE 3 */
@media only screen and (min-width: 767px) and (max-width: 991px) 
/* All Mobile Sizes (devices and browser) - BROWSER SIZE 4 */
@media only screen and (max-width: 767px) 
/* Landscape phones and down - BROWSER SIZE 5 */
@media (max-width: 480px) 
/* iphone portrait mode - BROWSER SIZE 6 */
@media (max-width: 320px) 

我是新手,做了很多研究,但我有几个问题:

我计划有两个 HTML 块,一个隐藏,并使用 JS 或 CSS 根据用户是否在移动设备上隐藏适当的块。

我希望避免使用用户代理,因为太多了。默认情况下,Android 不再解析没有“电话:”的数字(根据其他帖子)。我在 Nexus 5 上进行了测试。另一方面,Firefox 要求设备在“电话:”链接上使用。

  1. 我可以使用我当前的@media CSS 块吗?如果是这样,视网膜呢?
  2. 或者基于用户代理的 JS 是否可以以某种方式解决?
  3. 其他选项,我的意思是大多数人都做什么???

感谢您的帮助。

【问题讨论】:

    标签: javascript css mobile user-agent


    【解决方案1】:

    经过更多研究后,我选择了一个 JavaScript 库 isMobile。

    https://github.com/kaimallea/isMobile

    似乎很多人都在使用它,所以我认为它会起作用。

    我担心的是,如果出现新设备,我必须不断更新这个库...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-15
      • 1970-01-01
      • 1970-01-01
      • 2017-10-10
      • 1970-01-01
      相关资源
      最近更新 更多