x-ms-format-detection

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The x-ms-format-detection property determines whether data formats within content are automatically detected and (if found) converted to clickable links.

This proprietary property is specific to Internet Explorer and Microsoft Edge.

Syntax

<html x-ms-format-detection="none">
element[i].setAttribute("x-ms-format-detection", "none");

Value

Type: String

all: All supported data formats are detected.

none: Format detection is turned off.

phone: Phone number patterns are matched.

*Note that links created through format detection do not affect the content or layout of the Document Object Model (DOM).

Example

To disable this automatic detection only when a certain condition is met, use JavaScript to add x-ms-format-detection attributes to elements, differentiating between mobile (detection enabled) and desktop (detection disabled) devices:

if (window.matchMedia('(min-width: 1024px)').matches) {
    var e = document.getElementsByClassName("phone");
    for (i = 0; i < e.length; i++)
        e[i].setAttribute("x-ms-format-detection", "none");
}

In this example, phone numbers would keep the automatic styling as long as the viewport is smaller than 1024px.

See also

Document Tags and Contributors

Contributors to this page: ExE-Boss, mattwojo
Last updated by: ExE-Boss,