JavaScript Document hasUnpartitionedCookieAccess() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Method

Definition

document.hasUnpartitionedCookieAccess() asks whether this document already has access to third-party, unpartitioned cookies. It returns a Promise<boolean> and is part of the Storage Access API. MDN: it is a new name for hasStorageAccess().

Pass the required arguments shown below. Check return values and browser support before you rely on the result.

Syntax

Call document.hasUnpartitionedCookieAccess. Start with this line.

JavaScript
document.hasUnpartitionedCookieAccess()
CallWhat it does
document.hasUnpartitionedCookieAccess()Primary signature.
document.hasUnpartitionedCookieAccess(...)Call with the arguments your case needs.

Built into the browser. Call hasUnpartitionedCookieAccess(...) on document — no import required.

Library declarations
JavaScript
document.hasUnpartitionedCookieAccess()

Parameters

ParameterDescription
Feature detectRequired. Limited availability name

Return Value

Return ValueDescription
*Promise resolving to boolean

JavaScript Examples

Example 1 — MDN: Granted vs Denied

Classic MDN sample using .then() on the Promise boolean.

JavaScript
document.hasUnpartitionedCookieAccess().then((hasAccess) => {
  if (hasAccess) {
    console.log("cookie access granted");
  } else {
    // you may want to call requestStorageAccess()
    console.log("cookie access denied");
  }
});
Try It Yourself

How It Works

  1. Call with no args. The method returns a Promise (MDN).
  2. Resolve to a boolean. true means unpartitioned cookie access is indicated.
  3. Branch. Log granted, or prepare to call requestStorageAccess().
  4. Caveat. On Firefox/Safari this name may be missing — see Example 2.

Example 2 — Feature-Detect First

Guard Limited availability before calling the newer name.

JavaScript
async function checkNewerName() {
  if (typeof document.hasUnpartitionedCookieAccess !== "function") {
    console.log("missing — try hasStorageAccess()");
    return;
  }
  const hasAccess = await document.hasUnpartitionedCookieAccess();
  console.log("hasAccess:", hasAccess);
}

checkNewerName();
Try It Yourself

How It Works

  1. Test for a function. Avoids a TypeError on unsupported browsers.
  2. Exit early if missing. Point learners to the Baseline alias.
  3. Await the result. Still asynchronous even though the answer is a boolean.
  4. Log the flag. Use it to decide whether to request access next.

Example 3 — Cross-Browser Helper

Prefer the Baseline name, then fall back to the newer alias.

JavaScript
async function hasUnpartitionedCookies() {
  const fn =
    typeof document.hasStorageAccess === "function"
      ? document.hasStorageAccess.bind(document)
      : typeof document.hasUnpartitionedCookieAccess === "function"
        ? document.hasUnpartitionedCookieAccess.bind(document)
        : null;

  if (!fn) return { supported: false, hasAccess: null };
  return { supported: true, hasAccess: await fn() };
}

hasUnpartitionedCookies().then(console.log);
Try It Yourself

How It Works

  1. Pick a function. Lead with hasStorageAccess for Baseline reach.
  2. Bind document. Keeps this correct when calling later.
  3. Return a small object. Separates “API missing” from “access denied”.
  4. Production tip. Call one helper; do not invoke both names on every check.

Browser Support

Document.hasUnpartitionedCookieAccess() is Limited availability on MDN (not Baseline). Support is mainly Chromium-based. Prefer hasStorageAccess() for wider reach. See the MDN hasUnpartitionedCookieAccess() reference.

✓ Limited availability

Document.hasUnpartitionedCookieAccess()

Newer name for the Storage Access cookie check. Feature-detect and fall back to hasStorageAccess().

Limited Not Baseline
Google Chrome 125+
Yes
Microsoft Edge 125+
Yes
Opera 111+
Yes
Mozilla Firefox Not supported
No
Apple Safari Not supported
No
Internet Explorer Not supported
No
hasUnpartitionedCookieAccess() Partial

Bottom line: Use this clearer name when present. For Firefox, Safari, and older browsers, call hasStorageAccess() instead.

Frequently Asked Questions

It returns a Promise that resolves to a boolean: true if the document has access to third-party, unpartitioned cookies; false if not. It is part of the Storage Access API (MDN).
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline) because some major browsers do not ship this newer method name yet.
Yes. MDN: hasUnpartitionedCookieAccess() is a new name for Document.hasStorageAccess(). There are no current plans to remove hasStorageAccess().
No. Call it with empty parentheses: document.hasUnpartitionedCookieAccess().
Feature-detect both. Prefer hasStorageAccess() for Baseline reach (Firefox/Safari), and use hasUnpartitionedCookieAccess() when present (mainly Chromium). A small helper that tries either name is best.
MDN: storage access has not been granted already; you may want to call document.requestStorageAccess() — often from a user gesture.

Next: importNode()

Learn how to copy nodes from another document into the current page.

importNode() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful