Javascript 如何删除 Skype 电话号码识别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3448372/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I remove Skype phone number recognition?
提问by Bharanikumar
If Skype is installed, phone numbers are showing up with a Skype icon in some browsers.
如果安装了 Skype,电话号码会在某些浏览器中显示为 Skype 图标。
I don't want to show Skype icons anywhere, ever.
我不想在任何地方显示 Skype 图标,永远。
Is there any JavaScript or PHP function that can handle this?
是否有任何 JavaScript 或 PHP 函数可以处理这个问题?
回答by hans
Use the following CSS to prevent skype from formatting the numbers on your page:
使用以下 CSS 来防止 Skype 格式化页面上的数字:
span.skype_pnh_container {display:none !important;}
span.skype_pnh_print_container {display:inline !important;}
editSkype starts adding numbers in the class names to make them unique. You can solve by using the new Css selectors
编辑Skype 开始在班级名称中添加数字以使其独一无二。您可以使用新的 Css 选择器来解决
span.skype_pnh_container {display:none !important;}
span.skype_pnh_print_container, span[class^="skype_pnh_print_container"] {display:inline !important;}
回答by krisdyson
Add this
添加这个
<meta name="SKYPE_TOOLBAR" content ="SKYPE_TOOLBAR_PARSER_COMPATIBLE"/>
回答by Wesley Murch
After searching Google for an answer to this, it seems the issue still persists as we approach the year 2012. Apparently the <meta>tag no longer works, and the Skype plugin is as intrusive as ever - ruining SKU and part numbersin some instances (incorrectly interpreting them as phone numbers).
在搜索谷歌寻找答案后,似乎问题在我们接近 2012 年时仍然存在。显然<meta>标签不再有效,而且 Skype 插件和以往一样具有侵入性 -在某些情况下破坏 SKU 和部件号(错误地解释它们作为电话号码)。
I was surprised to see so many people misunderstand the desire to disable this from a web developer's point of view, and offer solutions to turn it off by changing browser settings and the like. Of course, we can't really expect our users to do this.
我很惊讶地看到这么多人从 Web 开发人员的角度误解了禁用它的愿望,并提供了通过更改浏览器设置等来关闭它的解决方案。当然,我们不能真的期望我们的用户这样做。
Skype will take something like this:
Skype 将采取这样的事情:
555-555-5555
And turn it into this:
并将其变成这样:
<span class="skype_pnh_print_container">
555-555-5555
</span>
<span class="skype_pnh_container" dir="ltr">
<span class="skype_pnh_mark"> begin_of_the_skype_highlighting</span>
<span class="skype_pnh_highlighting_inactive_common" title="Call this phone number in United States of America with Skype: +15555555555" dir="ltr">
<span class="skype_pnh_textarea_span"><span class="skype_pnh_text_span">555-555-5555</span>
</span>
</span>
<span class="skype_pnh_mark">end_of_the_skype_highlighting</span>
</span>
Which looks like this: 
看起来像这样: 
Copy and pasting a Skype'd phone number in rich text (like in an email, WYSIWYG or Word document) may end up something like this:
以富文本格式(如电子邮件、所见即所得或 Word 文档)复制和粘贴 Skype 的电话号码可能会导致如下结果:
begin_of_the_skype_highlighting 555-555-5555 end_of_the_skype_highlighting
Awful, and there's no definitive way to prevent it. The only way I foundto deal with this intrusion is by removing the markup with javascript.
太可怕了,没有明确的方法来阻止它。我发现处理这种入侵的唯一方法是使用 javascript 删除标记。
Example using jQuery:
使用 jQuery 的示例:
window.setTimeout(function() {
// Remove the class from the wrapper <span> Skype adds to the number
$('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
// Remove the generated content from Skype
$('.skype_pnh_container').remove();
}, 100); // If it doesn't work, set a higher value
You will get a flash of ugliness first, but the setTimeoutis necessary because the Skype content is generated just after the page is loaded.
您首先会看到一闪而过的丑陋,但这setTimeout是必要的,因为 Skype 内容是在页面加载后立即生成的。
回答by Nat
I tried the (updated) css as suggested by hans, but it doesn't work in the latest version of Chrome (17.0.963.78 m)
我按照 hans 的建议尝试了(更新的)css,但它在最新版本的 Chrome (17.0.963.78 m) 中不起作用
It seems the skype plugin has changed again as the code generated by skype (in my version of Chrome) is different from that shown by Madmartigan
由于Skype生成的代码(在我的Chrome版本中)与Madmartigan显示的不同,Skype插件似乎再次发生了变化
I tried putting a comment in the middle of my phone number:
我试着在我的电话号码中间加一条评论:
eg:
例如:
555<!--stop skype -->-555-5555
And this seems to work. i.e it stops skype recognising it as a phone number. The only thing I'm not sure of is how it affects a Google search for the phone number.
这似乎有效。即它停止Skype 将其识别为电话号码。我唯一不确定的是它如何影响 Google 搜索电话号码。
I did run the page through a bot simulator:
我确实通过机器人模拟器运行了页面:
http://www.xml-sitemaps.com/se-bot-simulator.html
http://www.xml-sitemaps.com/se-bot-simulator.html
and the comment didn't show up, so I'm hoping it won't affect Google search.
并且评论没有出现,所以我希望它不会影响谷歌搜索。
CSS would be the best solution for me but is too much of a moving target, so I prefer the 'comment' approach to the javascript one, but I guess different approaches are easier in different cases.
CSS 对我来说是最好的解决方案,但它的移动目标太多了,所以我更喜欢 'comment' 方法而不是 javascript 方法,但我想不同的方法在不同的情况下更容易。
edit
编辑
OK eat my words. Skype is quite smart. If your phone number is prefixed by the words "call us on" rather than "phone" which I initially tested with, then adding a comment inside the number doesn't work.
好吧,吃我的话。Skype 非常聪明。如果您的电话号码的前缀是“给我们打电话”,而不是我最初测试时使用的“电话”,那么在号码中添加注释是行不通的。
I tried another approach which is to use the soft hyphen e.g.
我尝试了另一种方法,即使用软连字符,例如
555­-555-5555
and this worked.
这有效。
回答by Boutros AbiChedid
I don't know of any PHP or JavaScript code that can remove Skype icons from phone numbers: But there are several ways that you can stop Skype from highlighting (i.e. remove skype icon) phone numbers:
我不知道任何可以从电话号码中删除 Skype 图标的 PHP 或 JavaScript 代码:但是有几种方法可以阻止 Skype 突出显示(即删除 Skype 图标)电话号码:
From a Developers point of View you can:
从开发人员的角度来看,您可以:
- Use HTML: Soft Hyphen
- Use CSS
- Or use Meta Tag
- 使用 HTML:软连字符
- 使用 CSS
- 或使用元标记
From a user's point of view, the user can:
从用户的角度来看,用户可以:
- Disable or uninstall skype add-on from the browser. (see comment)
- 从浏览器禁用或卸载 Skype 插件。(见评论)
For more details check the reference: How To Prevent Skype from Highlighting Phone Numbers
有关更多详细信息,请查看参考:如何防止 Skype 突出显示电话号码
回答by pakore
That is the skype plugin of your browser. When you install skype software, it automatically adds that plugin for firefox and IE AFAIK.
那是浏览器的Skype插件。当您安装 Skype 软件时,它会自动为 Firefox 和 IE AFAIK 添加该插件。
Just remove the plugin or the software and you are good to go. Anyway, the visitors of your website may have the software installed though.
只需删除插件或软件即可。无论如何,您网站的访问者可能已经安装了该软件。
回答by Reuben Mallaby
Uninstall Skype and see if it changes.
卸载 Skype 并查看它是否发生变化。
Skype usually interacts witht your browser and adds its own formatting for phone numbers.
Skype 通常会与您的浏览器进行交互,并为电话号码添加自己的格式。
回答by Mohit
Here are the steps have to implement into code.
以下是必须在代码中实现的步骤。
Step 1: add meta tag and style into your page head
第 1 步:将元标记和样式添加到页面标题中
<head>
<head>
<meta name="SKYPE_TOOLBAR" content ="SKYPE_TOOLBAR_PARSER_COMPATIBLE"/>
<meta name="SKYPE_TOOLBAR" content ="SKYPE_TOOLBAR_PARSER_COMPATIBLE"/>
<style>
<style>
span.skype_pnh_container {display:none !important;}span.skype_pnh_print_container {display:inline !important;}
span.skype_pnh_container {display:none !important;}span.skype_pnh_print_container {display:inline !important;}
</style>
</style>
</head>
</head>
Step 2:
wrap your numbers inside <span>like:
第 2 步:将您的数字包裹在里面,<span>例如:
<span>123-</span><span>123-1234</span>
<span>123-</span><span>123-1234</span>
This worked for me. :)
这对我有用。:)
回答by user3716491
No need for anything complicated, just go to your browser -> internet options -> Programs -> Manage add-ons, find Skype, click on to call, and then disable it.
不需要任何复杂的事情,只需转到您的浏览器 -> 互联网选项 -> 程序 -> 管理加载项,找到 Skype,点击通话,然后禁用它。
That's it!
就是这样!
回答by symcbean
on browser phone number are showing with skype icon
浏览器上的电话号码显示有 Skype 图标
No they are not. Some browsers may have specific functionality for this. Alternatively it may be implemented by the site serving the page. In the case of the former, you'd need to provide detils of which browser - and its probably not controllable from serverside anyway.
不,他们不是。某些浏览器可能具有特定的功能。或者,它可以由提供页面的站点来实现。在前者的情况下,您需要提供有关哪个浏览器的详细信息 - 无论如何它可能无法从服务器端控制。
C.
C。

