禁用 Lync 单击呼叫检测网页中的号码

发布于 2024-11-24 20:06:38 字数 345 浏览 2 评论 0原文

有没有办法阻止 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

慈悲佛祖 2024-12-01 20:06:38

我找到了一些选项,但没有一个像在页面中添加 META 标记一样简单或干净(微软绝对应该给我们作为一个选项)。

选项 1:在电话号码中插入标记

在电话号码中间添加空白 SPAN 之类的内容足以摆脱 Lync 的检测。这是一个高度手动的选项,因为它要求您编辑页面上的每个电话号码。但它可以很方便地禁用页面上的一两个数字,同时允许检测到任何其他数字。

<p>For help, please call 1-<span></span>800-555-1234.</p>

选项#2:编写附加标记的脚本

Lync 似乎以一种非常可预测的方式格式化电话号码。它使用(据我所知)一致的类名将 SPAN 包裹在号码周围,然后附加一个包含拨号图标的 A 锚点。

<!-- Lync formatting -->
<p>For help, please call
  <span class="baec5a81-e4d6-4674-97f3-e9220f0136c1" style="white-space: nowrap;">
    1-800-555-1234 
    <a title="Call: 1-800-555-1234" style="...">
      <img title="Call: 1-800-555-1234" src="data:image/png;base64,..."/>
    </a>
  </span>
.</p>

鉴于用于类名的非常独特的 Guid,您可以使用自己的客户端脚本来定位它并隐藏它或执行任何操作。隐藏所有 Lync 图标的 jQuery 方法可能如下所示:

$("span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a").hide();

更新!选项 #2a:删除附加标记的样式

使用与上面脚本示例相同的技术,您可以使用 CSS 简单地删除有问题的锚标记。这应该比基于脚本的解决方案更可取。

span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a {
   display: none !important;
}

选项#3:使用TEL锚点作为先发制人的攻击

有一个标记电话号码以与 VOIP/拨号程序兼容的标准化方法。它使用带有 tel: 协议的标准 A 锚点。这具有双重效果,不仅禁用 Lync 的侵入性标记,而且还为任何知道如何拨打号码 (Skype) 和移动设备(iOS 和 Android)的设备提供更好的支持。

<p>For help, please call <a href="tel:1-800-555-1234">1-800-555-1234</a>.</p>

现在,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.

<p>For help, please call 1-<span></span>800-555-1234.</p>

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 an A anchor which contains the dialing icon.

<!-- Lync formatting -->
<p>For help, please call
  <span class="baec5a81-e4d6-4674-97f3-e9220f0136c1" style="white-space: nowrap;">
    1-800-555-1234 
    <a title="Call: 1-800-555-1234" style="...">
      <img title="Call: 1-800-555-1234" src="data:image/png;base64,..."/>
    </a>
  </span>
.</p>

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:

$("span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a").hide();

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.

span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a {
   display: none !important;
}

Option #3: Use a TEL anchor as a preemptive strike

There is a standardized way to markup a phone number for compatibility with VOIP/dialing programs. It uses a standard A anchor with a tel: 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).

<p>For help, please call <a href="tel:1-800-555-1234">1-800-555-1234</a>.</p>

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

前事休说 2024-12-01 20:06:38

我已建议对选项 #2 进行编辑,但在其获得批准之前,我将继续将其放在这里。 user2200197 问题的原因是需要指定 !important 标记,因为锚标记指定了一个显示值,否则会覆盖它。

span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a {
   display: none !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.

span.baec5a81-e4d6-4674-97f3-e9220f0136c1 > a {
   display: none !important;
}
撕心裂肺的伤痛 2024-12-01 20:06:38

我找到了以下正则表达式(在 此博客),Lync 插件似乎使用该插件:

(\+?1[\-\. ])?(\(\d{3}\)|\d{3})[\-\. ]?\d{3}[\-\. ]?\d{4})
((\+?1[\-\. ])?(\((800|880|888|877|866|855|844|900)\)|(800|880|888|877|866|855|844|900))[\-\.0-9A-Za-z]{7,9})
(\+\d+[\-\. ](\(\d+\)[\- ]?)?\d[\d\-\. ]+\d)
((x|X)\d{3,5})

因此使用   应阻止 Lync 检测号码。

I've found the following regular expressions (on this blog) which the Lync plugin seems to use:

(\+?1[\-\. ])?(\(\d{3}\)|\d{3})[\-\. ]?\d{3}[\-\. ]?\d{4})
((\+?1[\-\. ])?(\((800|880|888|877|866|855|844|900)\)|(800|880|888|877|866|855|844|900))[\-\.0-9A-Za-z]{7,9})
(\+\d+[\-\. ](\(\d+\)[\- ]?)?\d[\d\-\. ]+\d)
((x|X)\d{3,5})

So using   or should prevent Lync from detecting the numbers.

治碍 2024-12-01 20:06:38

我无法让选项 2 发挥作用。我认为这是因为加载项是在页面加载后触发的。所以这让我开始思考...如果我在页面加载 5 秒后触发此操作,则隐藏元素。这个理论被证明是成功的,但它也隐藏了电话号码。

我更进一步,在删除电话号码后重建了 Lync Click to Call 类的元素。我的步骤可能比较粗糙,但是很有效。

    var ie = (document.all) ? true : false;

    function hideClass(objClass){
     //  This function will hide Elements by object Class
     //  Works with IE and Mozilla based browsers

    var elements = (ie) ? document.all : document.getElementsByTagName('*');
       for (i=0; i<elements.length; i++){
         //Loop through the elements until it finds one with the correct class name
         if (elements[i].className==objClass){
           //Extract the phone number from the element
           strPhone = getPhone(elements[i].innerHTML);
           //Replace the element with the phone number
           elements[i].outerHTML = "<SPAN class='baec5a81-e4d6-4674-97f3-e9220f0136c1'>"+strPhone+"</SPAN>"
         }
       }
     }
     function getPhone(thisStr){
        newStr = "";
        for (n=0; n<thisStr.length; n++){
            currChar = thisStr.substr(n,1)
            //Loop Through until it hits the first tag opening
            if (currChar != "<"){
                newStr+=currChar
            }else{
                break;
            }
        }
        return newStr;
     }

     function viewHTML(){
        alert(document.body.innerHTML)
     }

     function startTimer(){
        // 5 Seconds after the page loads, run the 
        window.setTimeout(function(){hideClass('baec5a81-e4d6-4674-97f3-e9220f0136c1');},5000);
     }
     window.onload=startTimer();

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.

    var ie = (document.all) ? true : false;

    function hideClass(objClass){
     //  This function will hide Elements by object Class
     //  Works with IE and Mozilla based browsers

    var elements = (ie) ? document.all : document.getElementsByTagName('*');
       for (i=0; i<elements.length; i++){
         //Loop through the elements until it finds one with the correct class name
         if (elements[i].className==objClass){
           //Extract the phone number from the element
           strPhone = getPhone(elements[i].innerHTML);
           //Replace the element with the phone number
           elements[i].outerHTML = "<SPAN class='baec5a81-e4d6-4674-97f3-e9220f0136c1'>"+strPhone+"</SPAN>"
         }
       }
     }
     function getPhone(thisStr){
        newStr = "";
        for (n=0; n<thisStr.length; n++){
            currChar = thisStr.substr(n,1)
            //Loop Through until it hits the first tag opening
            if (currChar != "<"){
                newStr+=currChar
            }else{
                break;
            }
        }
        return newStr;
     }

     function viewHTML(){
        alert(document.body.innerHTML)
     }

     function startTimer(){
        // 5 Seconds after the page loads, run the 
        window.setTimeout(function(){hideClass('baec5a81-e4d6-4674-97f3-e9220f0136c1');},5000);
     }
     window.onload=startTimer();
后eg是否自 2024-12-01 20:06:38

我在此处找到了一个有用的代码片段,可以删除 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文