处理tel:anchor [英] Dealing with tel: anchor

查看:156
本文介绍了处理tel:anchor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个电话号码的锚点。在手机上很棒。在使用Skype或Google Voice的台式机上,它很不错。问题出在台式机上,只是不知道如何处理。

I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it's good. The problem is on desktops that just don't know how to deal with that.

我该怎么办?检测它是否不可移动并更改链接?我仍然希望链接显示,只是URL不同。

What should I do? Detect if it's not mobile and change the link? I still want the link to show, just the URL to be different.

有更好的方法吗?如果没有,我如何在JavaScript中检测移动设备以更改href属性?

Is there a better way? If not, how do I detect mobile in JavaScript in order to change the href attribute?

谢谢。

推荐答案

要检测浏览器是否使用JavaScript从移动设备启动: http:// detectmobilebrowser。 com /

To detect if the browser is launching from a mobile in JavaScript: http://detectmobilebrowser.com/

然后,您可以使用正则表达式在JavaScript中检测电话号码,例如: http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7

Then you can detect a phone number in JavaScript using a regular expression, such as one of those: http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7

最后重写链接:aLink.href =...

And finally rewrite the link: aLink.href="..."

网络浏览器负责用于启动某个链接的相关应用程序,我猜skype正在注册桌面上的电话号码。你恐怕不能在网页上做任何事情。

The web-browser is responsible for launching the associated application for a certain link and I guess skype is registering for the phone numbers in the desktop. You can't do anything from the web-page I'm afraid.

这篇关于处理tel:anchor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆