Window: sự kiện appinstalled

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The appinstalled event of the Web Manifest API is fired when the browser has successfully installed a page as an application.

This event is not cancelable and does not bubble.

Cú pháp

Sử dụng tên sự kiện trong các phương thức như addEventListener(), hoặc thiết lập thuộc tính trình xử lý sự kiện.

js
addEventListener("appinstalled", (event) => { })

onappinstalled = (event) => { }

Kiểu sự kiện

Một Event chung.

Ví dụ

You can use the appinstalled event in an addEventListener method:

js
window.addEventListener("appinstalled", () => {
  console.log("Thank you for installing our app!");
});

Or use the onappinstalled event handler property:

js
window.onappinstalled = () => {
  console.log("Thank you for installing our app!");
};

Đặc tả kỹ thuật

Specification
Manifest Incubations
# dom-window-onappinstalled

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