StorageAccessHandle: phương thức BroadcastChannel()
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note:
Xem BroadcastChannel() để hiểu cách sử dụng.
Cú pháp
js
BroadcastChannel(channelName)
Tham số
Giá trị trả về
Một đối tượng BroadcastChannel không phân vùng.
Ngoại lệ
SecurityErrorDomException-
Được ném ra nếu quyền truy cập không được cấp.
Ví dụ
js
document.requestStorageAccess({ BroadcastChannel: true }).then(
(handle) => {
console.log("BroadcastChannel access granted");
handle.BroadcastChannel(channel_name);
},
() => {
console.log("BroadcastChannel access denied");
},
);
Note: Xem Using the Storage Access API để biết ví dụ đầy đủ hơn.
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Extending Storage Access API (SAA) to non-cookie storage> # dom-storageaccesshandle-broadcastchannel> |