requestStorageAccess method
The requestStorageAccess()
method of the Document interface allows
content loaded in a third-party context (i.e., embedded in an iframe
) to
request access to
third-party cookies
and
unpartitioned state.
This is relevant to user agents that, by default, block access to
third-party,
unpartitioned
cookies to improve privacy (e.g., to prevent tracking), and is part of the
Storage Access API.
To check whether permission to access third-party cookies has already been
granted, you can call Permissions.query, specifying the feature name
"storage-access"
.
Note: Usage of this feature may be blocked by a Permissions Policy set on your server. In addition, the document must pass additional browser-specific checks such as allowlists, blocklists, on-device classification, user settings, anti-clickjacking heuristics, or prompting the user for explicit permission.
Implementation
external JSPromise<JSAny?> requestStorageAccess();