WindowControlsOverlay
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Giao diện WindowControlsOverlay của Window Controls Overlay API hiển thị thông tin về hình học của vùng thanh tiêu đề trong Progressive Web Apps trên máy tính, và một sự kiện để biết khi nào nó thay đổi. Giao diện này có thể truy cập từ Navigator.windowControlsOverlay.
Thuộc tính phiên bản
WindowControlsOverlay.visibleRead only Thử nghiệm-
Một Boolean cho biết lớp phủ điều khiển cửa sổ có hiển thị hay không.
Phương thức phiên bản
WindowControlsOverlay.getTitlebarAreaRect()Thử nghiệm-
Trả về kích thước và vị trí của thanh tiêu đề.
Sự kiện
Lắng nghe các sự kiện này bằng cách sử dụng EventTarget.addEventListener() hoặc bằng cách gán trình lắng nghe sự kiện vào thuộc tính oneventname tương ứng của giao diện này.
geometrychangeThử nghiệm-
Được kích hoạt khi hình học của vùng thanh tiêu đề thay đổi.
Ví dụ
if ("windowControlsOverlay" in navigator) {
navigator.windowControlsOverlay.addEventListener(
"geometrychange",
(event) => {
if (event.visible) {
const rect = event.titlebarAreaRect;
// Do something with the coordinates of the title bar area.
}
},
);
}
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Window Controls Overlay> # windowcontrolsoverlay-interface> |