document.hasStorageAccess() returns a Promise that resolves to a boolean: whether this document has access to third-party, unpartitioned cookies (MDN). It is part of the Storage Access API and takes no parameters.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call document.hasStorageAccess. Start with this line.
JavaScript
document.hasStorageAccess()
Call
What it does
document.hasStorageAccess()
Primary signature.
document.hasStorageAccess(...)
Call with the arguments your case needs.
Built into the browser. Call hasStorageAccess(...) on document — no import required.
Library declarations
JavaScript
document.hasStorageAccess()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
Promise resolving to boolean
JavaScript Examples
Example 1 — Await the Boolean
Call hasStorageAccess() and log whether access is granted.
User gesture tip. MDN: if called during a gesture, the resolve handler can keep user-activation for APIs that need it.
Example 3 — Same Idea as the Newer Name
MDN: hasStorageAccess() is another name for hasUnpartitionedCookieAccess().
JavaScript
async function compareNames() {
const a = await document.hasStorageAccess();
const hasAlias = typeof document.hasUnpartitionedCookieAccess === "function";
if (!hasAlias) return { a, alias: "missing" };
const b = await document.hasUnpartitionedCookieAccess();
return { a, b, same: a === b };
}
compareNames().then(console.log);
Call the classic name.hasStorageAccess() is Baseline and widely taught.
Detect the alias. Newer engines also expose hasUnpartitionedCookieAccess().
Compare booleans. When both exist, they should agree (same meaning, MDN).
No removal plan. MDN: hasStorageAccess() is not being removed for the newer name.
Compatibility
Browser Support
Document.hasStorageAccess() is Baseline Widely available on MDN (since December 2023). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Document.hasStorageAccess()
Promise-based check for third-party unpartitioned cookie access across modern browsers.
BaselineWidely available
Google ChromeSupported
Yes
Mozilla FirefoxSupported
Yes
Apple SafariSupported
Yes
Microsoft EdgeSupported
Yes
OperaSupported
Yes
Internet ExplorerNot supported
No
hasStorageAccess()Wide
Bottom line: Safe for Storage Access API flows in modern browsers. Still treat the boolean as a hint and handle cookie failures. See the MDN Document.hasStorageAccess() reference.
Frequently Asked Questions
MDN: Document.hasStorageAccess() returns a Promise that resolves with a boolean indicating whether the document has access to third-party, unpartitioned cookies. It is part of the Storage Access API.
No. MDN marks Document.hasStorageAccess() as Baseline Widely available (since December 2023). It is not Deprecated, Experimental, or Non-standard.
No. MDN: hasStorageAccess() takes no parameters.
MDN example: storage access has not been granted already; you may want to call document.requestStorageAccess().
Not always. MDN notes user settings may block third-party cookies even when true is returned, and some browsers may return false even when cookies are still accessible. Handle cookie errors gracefully and optionally probe document.cookie.
MDN: hasStorageAccess() is another name for Document.hasUnpartitionedCookieAccess(). There are no current plans to remove hasStorageAccess() in favor of the newer name.