禁用 Lync 单击呼叫检测网页中的号码
有没有办法阻止 Microsoft Lync 检测网页中的电话号码,并将其“点击呼叫”图标添加到 Internet Explorer 中的该电话号码?
显然,客户端可以在 Internet Explorer 中禁用此功能,但是我想为所有访问特定网站的人禁用此功能,因为它不能很好地与网站上使用的嵌入字体配合使用。
要为 Skype 执行此操作,我会将以下元标记添加到我的网页标题中:
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />
谢谢,
Peter
Is there a way to stop Microsoft Lync from detecting phone numbers in a web page, and adding its click to call icon to that phone number in Internet Explorer?
Obviously the client can disable this functionality in Internet Explorer, however I would like to disable this for all who visit a particular website, as it is not playing nicely with embedded fonts in use on the website.
To do this for Skype I would add the following meta tag into my web page's header:
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />
Thanks,
Peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我找到了一些选项,但没有一个像在页面中添加 META 标记一样简单或干净(微软绝对应该给我们作为一个选项)。
选项 1:在电话号码中插入标记
在电话号码中间添加空白
SPAN
之类的内容足以摆脱 Lync 的检测。这是一个高度手动的选项,因为它要求您编辑页面上的每个电话号码。但它可以很方便地禁用页面上的一两个数字,同时允许检测到任何其他数字。选项#2:编写附加标记的脚本
Lync 似乎以一种非常可预测的方式格式化电话号码。它使用(据我所知)一致的类名将
SPAN
包裹在号码周围,然后附加一个包含拨号图标的A
锚点。鉴于用于类名的非常独特的 Guid,您可以使用自己的客户端脚本来定位它并隐藏它或执行任何操作。隐藏所有 Lync 图标的 jQuery 方法可能如下所示:
更新!选项 #2a:删除附加标记的样式
使用与上面脚本示例相同的技术,您可以使用 CSS 简单地删除有问题的锚标记。这应该比基于脚本的解决方案更可取。
选项#3:使用
TEL
锚点作为先发制人的攻击有一个标记电话号码以与 VOIP/拨号程序兼容的标准化方法。它使用带有
tel:
协议的标准A
锚点。这具有双重效果,不仅禁用 Lync 的侵入性标记,而且还为任何知道如何拨打号码 (Skype) 和移动设备(iOS 和 Android)的设备提供更好的支持。现在,Lync 用户仍然可以单击该链接,这将提示他们使用 Lync“打开”该链接,无论他们使用什么浏览器(我已确认与 IE9、Firefox 和 Chrome 的兼容性)。这让我觉得两全其美:与用户的电话应用程序兼容,而不会破坏您的标记和布局。
在 Microsoft 提出 META 标签来解决这些问题之前,我们选择了#3。
更新:纳入了来自@marsman57的建议,以改进CSS选项#2
I've found a few options, but none are as simple or clean as adding a META tag to the page (which Microsoft absolutely should give us as an option).
Option #1: Insert markup into your phone number
Adding something like a blank
SPAN
into the middle of a phone number is sufficient to throw off Lync's detection. This is a highly manual option, as it requires you to edit every phone number on a page. But it could be handy for disabling one or two numbers on a page, while allowing any others to be detected.Option #2: Script away the additional markup
Lync appears to format phone numbers in a very predictable way. It wraps a
SPAN
around the number using a (as far as I can tell) consistent class name, then appends anA
anchor which contains the dialing icon.Given that very unique Guid used for the classname, you can target that with your own client script and hide it or do whatever. A jQuery approach to hide all Lync icons might look like:
UPDATE! Option #2a: Style away the additional markup
Using the same technique as the script example above, you can simply style away the offending anchor tag using CSS. This should be preferable to a script-based solution.
Option #3: Use a
TEL
anchor as a preemptive strikeThere is a standardized way to markup a phone number for compatibility with VOIP/dialing programs. It uses a standard
A
anchor with atel:
protocol. This has the dual effect of not only disabling Lync's intrusive markup, but also providing better support for anything that knows how to dial a number (Skype) and mobile devices (both iOS and Android).Now Lync users can still click the link, which will prompt them to "open" it with Lync, regardless of the browser they use (I've confirmed compatibility with IE9, Firefox and Chrome). This strikes me as the best of both worlds: compatibility with users' telephony application, without trouncing all over your markup and layout.
Until Microsoft comes up with a META tag to solve these issues, we've opted for #3.
UPDATE: Incorporated the suggestion from @marsman57 for improvement to CSS option #2
我已建议对选项 #2 进行编辑,但在其获得批准之前,我将继续将其放在这里。 user2200197 问题的原因是需要指定 !important 标记,因为锚标记指定了一个显示值,否则会覆盖它。
I have suggested an edit to option #2, but until it is approved, I'll go ahead and drop this here. The reason for user2200197's problem is that the !important tag needs to be specified because the anchor tag specifies a display value that overrides it otherwise.
我找到了以下正则表达式(在 此博客),Lync 插件似乎使用该插件:
因此使用
或
‐
应阻止 Lync 检测号码。I've found the following regular expressions (on this blog) which the Lync plugin seems to use:
So using
or
‐
should prevent Lync from detecting the numbers.我无法让选项 2 发挥作用。我认为这是因为加载项是在页面加载后触发的。所以这让我开始思考...如果我在页面加载 5 秒后触发此操作,则隐藏元素。这个理论被证明是成功的,但它也隐藏了电话号码。
我更进一步,在删除电话号码后重建了 Lync Click to Call 类的元素。我的步骤可能比较粗糙,但是很有效。
I was unable to get Option 2 to work. I think this is because the add-on is triggered after the page is loaded. So that got me to thinking... If I trigger this after 5 seconds of the page loading, then hide the elements. This theory proved successfull, but it hid the phone number too.
I took it a step further and rebuilt the element for the Lync Click to Call class after stripping out the phone number. My steps may be crude, but effective.
我在此处找到了一个有用的代码片段,可以删除 Lync 呼号。它将电话号码中的连字符替换为外观相似的字符,并且不再被识别为电话号码。
I found a useful snippet to remove the Lync Call sign here. It replaces the hyphen in the phone number with a similar looking character, and it is no longer identified as a phone number.