PreferenceManager: thuộc tính reducedData

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Thuộc tính chỉ đọc reducedData của giao diện PreferenceManager trả về một PreferenceObject dùng để ghi đè tùy chọn của người dùng về dữ liệu giảm của trang web.

Các cài đặt PreferenceObject.value hợp lệ cho reducedDatareduceno-preference.

Giá trị

Một PreferenceObject dùng để ghi đè tùy chọn của người dùng về dữ liệu giảm của trang web.

Ví dụ

Sử dụng cơ bản

Ví dụ này minh họa cách truy vấn tùy chọn dữ liệu giảm của người dùng.

js
if (navigator.preferences.reducedData.value === "reduce") {
  // The user prefers you use less data.
} else {
  // The user has stated no preference regarding data use.
}

Thông số kỹ thuật

Thông số kỹ thuật
Media Queries Level 5
# reduced-data-attribute

Tương thích trình duyệt