Back to Content

StorageAccessHandle: BroadcastChannel() method

files/en-us/web/api/storageaccesshandle/broadcastchannel/index.md

latest1.2 KB
Original Source

{{APIRef("Storage Access API")}}

[!NOTE] See {{domxref("BroadcastChannel.BroadcastChannel", "BroadcastChannel()")}} to understand usage.

Syntax

js-nolint
BroadcastChannel(channelName)

Parameters

  • channelName
    • : See {{domxref("BroadcastChannel.BroadcastChannel", "BroadcastChannel()")}}.

Return value

An unpartitioned {{domxref("BroadcastChannel")}} object.

Exceptions

  • SecurityError {{domxref("DomException")}}
    • : Thrown if access was not granted.

See {{domxref("BroadcastChannel.BroadcastChannel", "BroadcastChannel()")}}

Examples

js
document.requestStorageAccess({ BroadcastChannel: true }).then(
  (handle) => {
    console.log("BroadcastChannel access granted");
    handle.BroadcastChannel(channel_name);
  },
  () => {
    console.log("BroadcastChannel access denied");
  },
);

[!NOTE] See Using the Storage Access API for a more complete example.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also