document.requestStorageAccessFor(requestedOrigin) lets a top-level page ask for third-party cookie access on behalf of another origin in the same related website set. It returns a Promise that fulfills with undefined if granted, or rejects if denied (MDN).
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call document.requestStorageAccessFor. Start with this line.
JavaScript
document.requestStorageAccessFor(requestedOrigin)
Call
What it does
document.requestStorageAccessFor(requestedOrigin)
Primary signature.
document.requestStorageAccessFor(...)
Call with the arguments your case needs.
Built into the browser. Call requestStorageAccessFor(...) on document — no import required.
Library declarations
JavaScript
document.requestStorageAccessFor(requestedOrigin)
Parameters
Parameter
Description
requestedOrigin
Required. Origin URL string to request access for
Return Value
Return Value
Description
*
Promise → undefined or reject
JavaScript Examples
Example 1 — Feature-Detect
Check for the method before calling (MDN pattern).
JavaScript
const ok = "requestStorageAccessFor" in document;
console.log(ok ? "legacy API available" : "missing — do not depend on it");
Validate origins. Use real https://… origin URLs in legacy demos.
Compatibility
Browser Support
Document.requestStorageAccessFor() is Deprecated (to be removed) and Non-standard on MDN. It does not appear to be defined in any specification.
✓ Deprecated · Non-standard
Document.requestStorageAccessFor()
Legacy Chromium Privacy Sandbox helper. Feature-detect if you must inspect old pages; do not ship new products on it.
LegacyDeprecated API
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
document.requestStorageAccessFor()Avoid
Bottom line: Literacy only. Prefer requestStorageAccess() in embeds when Storage Access is required, and design for cookie partitioning.
Frequently Asked Questions
MDN: Document.requestStorageAccessFor() allows top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set. It returns a Promise that resolves if access was granted and rejects if denied.
Yes. MDN marks it Deprecated (to be removed) and Non-standard. It does not appear to be defined in any specification. Chrome withdrew related Privacy Sandbox / Related Website Sets features.
requestStorageAccess() is called by third-party embedded content for itself. requestStorageAccessFor() is called by the top-level page on behalf of another origin (for resources that cannot call the API themselves, such as cross-site images or scripts) (MDN).
A string requestedOrigin — the URL of the origin you are requesting third-party cookie access for (MDN). Invalid URLs throw TypeError.
MDN: call Permissions.query() with name "top-level-storage-access" and a requestedOrigin. That feature name differs from "storage-access" used with requestStorageAccess().
Yes in the common case. MDN: requests are automatically denied unless the top-level content is processing a user gesture (transient activation), or permission was already granted previously.