Chuyển đến:

Các tình nguyện viên của chúng tôi chưa dịch bài viết này thành Tiếng Việt. Tham gia với chúng tôi và hoàn thành công việc!
Bạn cũng có thể đọc bài viết trongEnglish (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

Document Tags and Contributors

Những người đóng góp cho trang này: Tigt, mdnwebdocs-bot, ExE-Boss, mattwojo
Cập nhật lần cuối bởi: Tigt,