document.requestStorageAccess() lets content in a third-party context (typically an <iframe>) request access to third-party cookies and other unpartitioned state. It is part of the Storage Access API and returns a Promise.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call document.requestStorageAccess. Start with this line.
JavaScript
document.requestStorageAccess() / (types)
Call
What it does
document.requestStorageAccess() / (types)
Primary signature.
document.requestStorageAccess(...)
Call with the arguments your case needs.
Built into the browser. Call requestStorageAccess(...) on document — no import required.
localStorage access denied
(handle path only runs when types are granted)
How It Works
Pass types. Ask only for the unpartitioned APIs you need.
Receive a handle. On fulfill, MDN returns a StorageAccessHandle.
Use the handle. e.g. handle.localStorage.setItem(...).
All-false types throw. Providing types with every property false raises InvalidStateError (MDN).
Compatibility
Browser Support
Document.requestStorageAccess() is a browser DOM API marked Baseline Widely available on MDN (across browsers since December 2023). Some parts of the feature may have varying support.
✓ Baseline Widely available *
Document.requestStorageAccess()
Storage Access API — third-party embeds request unpartitioned cookies / state under privacy rules.
It lets content loaded in a third-party context (for example an iframe) request access to third-party cookies and unpartitioned state. It is part of the Storage Access API.
No. MDN marks it Baseline Widely available (across browsers since December 2023). Some parts may have varying support. It is not Deprecated, Experimental, or Non-standard.
Usually yes. Requests are automatically denied unless the embed is processing a user gesture (transient activation), or permission was already granted previously.
undefined if cookie access was granted and no types parameter was provided; a StorageAccessHandle if types requested unpartitioned state; the Promise rejects if access was denied.
Call document.hasStorageAccess() (or hasUnpartitionedCookieAccess()). You can also use Permissions.query() with the feature name "storage-access".
After an embed activates storage-access permission, it should reload itself so the browser re-requests the resource with third-party unpartitioned cookies included.