96

I noticed that the new Microsoft Edge browser overrides my styles when it detects phone numbers:

<span class="phone">(123)123-1234</span>

See this jsfiddle (must be opened using Microsoft Edge :P).

This sort of intrudes upon the design of the website, and is rather obnoxious. Sure seems like a trait of a successor to IE :/

How can I override or disable this so my website users will not see it?

Jeroen
  • 60,696
  • 40
  • 206
  • 339
karns
  • 5,391
  • 8
  • 35
  • 57
  • I hope this isn't *actually* caused by malware... – karns Aug 13 '15 at 02:06
  • Check add-ons (don't have Edge), but some add-ons caused that behavior in IE-s... – sinisake Aug 13 '15 at 02:07
  • I can't even find the add ons for it :/ – karns Aug 13 '15 at 02:15
  • Ah, i see there are no add-ons at all in Edge... :) Good luck! :) – sinisake Aug 13 '15 at 02:36
  • 7
    I just today commented about this on Twitter: https://mobile.twitter.com/scunliffe/status/631484565492625409 at least as far as I can see for now until Microsoft reverses this poor decision you will need to add `` to every single page you have to get rid of this. :-( – scunliffe Aug 13 '15 at 02:47
  • 1
    It also gets applied to latitude/longitude numbers like 145.1231321 – behelit Jan 25 '18 at 00:44
  • 1
    Also the number formats that get highlighted vary with the region setting ("Home location") of the user's PC, so this will affect all users differently! This means when you test your pages your end users might actually see something different despite using the same browser: https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/dn454587%28v%3dvs.85%29 – SharpC Apr 09 '18 at 13:07
  • This thread is about how you remove linkifying of numbers similar to phone numbers, _as a webmaster or web author_. If you are a _user_ of Edge and you want to remove it when you browse, on any web page, edit the Windows Registry, e.g. with `regedit.exe` or PowerShell. Go to `HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main`, there create a new key ("folder") called `FormatDetection`. In it create a `DWORD` value with name `PhoneNumberEnabled` and value `0x00000000 (0)`. – Jeppe Stig Nielsen Nov 26 '18 at 10:13

4 Answers4

175

You can get rid of it by adding this meta tag in the header of your pages.

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

Microsoft's documentation on this tag.

Hopefully there will be a better way to turn this off globally without bloating pages... Or better yet disable this feature by default.

Rob
  • 14,746
  • 28
  • 47
  • 65
scunliffe
  • 62,582
  • 25
  • 126
  • 161
  • Good answer! Would you be able to add a link to docs regarding this, please? – karns Aug 13 '15 at 13:11
  • 9
    Stupid design. If someone would like to do that. At least, you could allow an attribute like "detect-phone=true" making it optional, because sometimes there is no need to allow your webapp to do that if its not intended too... – Miguel Aug 10 '16 at 11:08
59

If you don't want to disable for an entire page as the selected answer suggests, you can add the following attribute to a specific tag

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

Reference: https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/dn265018(v=vs.85)#controlling-phone-number-detection

Pang
  • 9,564
  • 146
  • 81
  • 122
maguy
  • 1,599
  • 1
  • 15
  • 26
  • 9
    I know this is a bit of an old answer, but for anyone looking this up: I had to add this to a parent tag (like the
    that's a step up from the label or whatever you're using to display the phone number).
    – Dortimer Feb 01 '18 at 19:46
  • +1 to both the answer and Debasertron's comment. Further on the comment, it seems to need to be a block-level parent - I tried with a span, which didn't work, but a div was fine. – Masala Oct 25 '18 at 08:41
31

The above answer works perfectly, but disables the ability to have click to call phone numbers (which is a major problem if you are building a responsive site). I have found a better work around to be make the phone number a link. Example:

<a href="tel:888-888-8888">(888) 888-8888</a>

This would then allow you to style the "link" however you want, and the "a" styles in your CSS override the Edge and iPhone styles on the phone number. The only issue with this is it makes the phone number a link for all devices, but I have found this not to be an issue as almost every device has some sort of click to call feature or app included.

cameron
  • 420
  • 5
  • 17
3

I've faced this issue, but with a slightly different use case: The number it's highlighting is not a phone number, so I don't want any special formatting.

For example you might have something like:

<div>The current date/time: May 08 2017 10:44:58 GMT Daylight Time</div>

For me*, Edge will convert 08 2017 10 into a phone number link. Thanks, Edge!

I've found that you can get around this by inserting invisible inline-block element into the middle of the string:

.notel{
  display:inline-block;
  height:0px;
  width:0px;
}
<span class="phone">(763)219-5222</span>
<div>The current date/time: May 08 2017 10:44:58 GMT Daylight Time</div>

<br>
<span class="phone">(763)2<span class="notel"></span>19-5222</span>
<div>The current date/time: May 08 2<span class="notel"></span>017 10:44:58 GMT Daylight Time</div>

I can't see if this works for your phone number as I don't see highlighting in either case. You might need to nudge the positioning of the span.

Incidentally, the fact that you can do this is one of the many reasons you shouldn't copy commands off webpages and into your terminal:

span{
display:inline-block;
height: 0px;
width: 0px;
overflow:hidden;
}
textarea{
  width: 300px;
  height:50px;
}
<div>echo "HELLO" <span>&& wreck this machine</span></div><div>echo "WORLD"</div>

<textarea ></textarea>
<div>
Select, copy and paste above commands into the textarea.
</div>

*I think Edge's highlighting of numbers is regional. Your jsfiddle isn't highlighted for me, but I'm in the UK. Here is seems to highlight numbers that begin with 0.

Jools
  • 839
  • 8
  • 22