Taming the automatic telephone number thing in the windows 10 edge browser

北城余情 提交于 2019-12-03 22:08:42

Apparently phone number detection was introduced in Internet Explorer 11, but not on desktops.

Here are ways to control it, taken from this MS article: Phone number format recognition

  • To disable the behavior for an element (and its child elements), set the x-ms-format-detection attribute to "none".
  • To disable the behavior for a webpage, use the meta element:

<meta name="format-detection" content="telephone=no"/>

  • To enable the behavior for an element (and its child elements), set the x-ms-format-detection attribute to "phone" or "all".

  • To selectively control the behavior using JavaScript, use setAttribute to change the value of the x-ms-format-detection attribute of the associate element or its parent. (Note that this needs to be done before the element or the parent is rendered in the DOM; dynamic changes are not supported.)

If I understand the article correctly, if phone detection is disabled at the browser level, the x-ms-format-detection attribute (or the meta tag) will be ignored.

Using the x-ms-format-detection="none" worked for me. However I had to add it to the parent element.

For example my phone number was wrapped in a span class so I had to add it to parent div above. Adding directly to the span tag didn't fix the issue on edge for me.

Hope that helps

I've found a way that works perfect for me, and it consist on change the tag where you have the number by an "a" (anchor) instead of any one you may have, with no need of href. Then, set text-underline to none and color to inherit. That's all.

If you add x-ms-format-detection="none" to the body tag it will be applied to the whole page.

<body x-ms-format-detection="none">

This should be a comment, but I dont have the reputation yet, sorry!

Building on good the previous answer by jfrej and subsequent comment by Ben Hillier, I'd like to point out that x-ms-format-detection="none" can work on a span element, but not with de default display: inline, rather style your span with a display: inline-block.

Similarly using <div x-ms-format-detection="none" style="display: inline">1234567890</div> will not work either.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!