serviceworker

Limited availability

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.

Member serviceworker chỉ định một service worker được cài đặt và đăng ký Just-In-Time (JIT) để chạy một ứng dụng thanh toán dựa trên web, cung cấp cơ chế thanh toán cho một phương thức thanh toán được chỉ định trên website của người bán. Xem Web-based Payment Handler API để biết thêm chi tiết.

Giá trị

Đối tượng serviceworker có thể chứa các giá trị sau:

scope Experimental Non-standard

Một chuỗi đại diện cho phạm vi đăng ký của service worker.

src Experimental Non-standard

Một chuỗi đại diện cho URL để tải script service worker từ đó.

use_cache Experimental Non-standard

Một giá trị boolean thiết lập cách HTTP cache được dùng cho tài nguyên script của service worker trong quá trình cập nhật. Nó cung cấp chức năng tương đương với một số giá trị của tùy chọn updateViaCache khi service worker được đăng ký qua JavaScript bằng ServiceWorkerContainer.register().

  • true: HTTP cache sẽ được truy vấn cho các import, nhưng script chính sẽ luôn được cập nhật từ mạng. Nếu không tìm thấy mục mới trong HTTP cache cho các import, chúng sẽ được tải từ mạng. Tương đương updateViaCache: "imports".
  • false: HTTP cache sẽ không được dùng cho script chính hoặc các import của nó. Tất cả tài nguyên script của service worker sẽ được cập nhật từ mạng. Tương đương updateViaCache: "none".

Ví dụ

Xem Web-based Payment Handler API > Concepts and usage.

Đặc tả

This feature does not appear to be defined in any specification.

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

Xem thêm