x-ms-format-detection

Relawan kami belum menerjemahkan artikel ini ke bahasa Bahasa Indonesia. Bergabunglah dan bantu kami menyelesaikannya!
Anda juga dapat membaca artikel ini dalam English (US).

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 attribute determines whether data formats within content are automatically detected and converted to clickable links.

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

Syntax

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

Value

all: All supported data formats are detected.

none: Format detection is turned off.

phone: Phone number patterns are matched.

Links created through format detection do not appear in the Document Object Model.

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 narrower than 1024 pixels.

See also

Tag Dokumen dan Kontributor

Kontributor untuk laman ini: Tigt, mdnwebdocs-bot, ExE-Boss, mattwojo
Terakhir diperbarui oleh: Tigt,