BeforeInstallPromptEvent: thuộc tính userChoice
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Thuộc tính userChoice của giao diện BeforeInstallPromptEvent biểu thị lựa chọn cài đặt mà người dùng đã đưa ra khi họ được nhắc cài đặt ứng dụng.
Giá trị
Một Promise được resolve thành một đối tượng chứa hai thuộc tính:
outcomeThử nghiệm Không chuẩn-
Một chuỗi cho biết người dùng có chọn cài đặt ứng dụng hay không. Giá trị này phải là một trong các giá trị sau:
"accepted": Người dùng đã cài đặt ứng dụng."dismissed": Người dùng đã không cài đặt ứng dụng.
platformThử nghiệm Không chuẩn-
Nếu người dùng chọn cài đặt ứng dụng, đây là một chuỗi đặt tên nền tảng đã chọn, là một trong các giá trị từ thuộc tính
BeforeInstallPromptEvent.platforms. Nếu người dùng chọn không cài đặt ứng dụng, đây là một chuỗi rỗng.
Khả năng tương thích với trình duyệt
Xem thêm
- Làm cho PWA có thể cài đặt
- How to provide your own in-app install experience trên web.dev (2021)