ServiceWorkerGlobalScope: sự kiện cookiechange

Limited availability

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.

Note: This feature is only available in Service Workers.

Sự kiện cookiechange của giao diện ServiceWorkerGlobalScope được kích hoạt khi một thay đổi cookie xảy ra khớp với danh sách đăng ký thay đổi cookie của service worker.

Sự kiện này không thể hủy và không nổi bọt.

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 một thuộc tính trình xử lý sự kiện.

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

oncookiechange = (event) => { }

Loại sự kiện

Một ExtendableCookieChangeEvent. Kế thừa từ ExtendableEvent.

Event ExtendableEvent ExtendableCookieChangeEvent

Đặc tả kỹ thuật

Specification
Cookie Store API
# dom-serviceworkerglobalscope-oncookiechange

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