JavaScript Document hasUnpartitionedCookieAccess() Method

Beginner
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Limited availability
Instance method

What You’ll Learn

document.hasUnpartitionedCookieAccess() is an instance method that returns a Promise resolving to whether this document can use third-party, unpartitioned cookies (see MDN Document: hasUnpartitionedCookieAccess()). MDN calls it a new name for hasStorageAccess(). Learn when each name appears, Limited availability caveats, and how to feature-detect safely.

01

Kind

Instance method

02

Args

None

03

Returns

Promise<boolean>

04

API

Storage Access

05

Alias of

hasStorageAccess()

06

Status

Limited

Introduction

Cookie names in APIs can be confusing. “Unpartitioned” means the classic shared cookie jar for a site — not the partitioned storage browsers use to reduce cross-site tracking. This method asks: does this document already have that access?

MDN: hasUnpartitionedCookieAccess() 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, and it is a new name for Document.hasStorageAccess().

💡
Think: “Same check, clearer name”

1) Prefer detecting hasStorageAccess for broad support
2) Also detect hasUnpartitionedCookieAccess in Chromium
3) await the Promise boolean
4) If false, consider requestStorageAccess() (MDN)

⚠️
Limited availability (MDN)

This newer method name is not Baseline. Firefox and Safari currently expose the Storage Access check mainly via hasStorageAccess(). Always feature-detect, and fall back to the older name when this one is missing.

Related tutorials: hasStorageAccess(), hasFocus(), hasRedemptionRecord().

Understanding document.hasUnpartitionedCookieAccess()

An instance method on the Document interface from the Storage Access API (MDN). It takes no arguments and returns a Promise<boolean>. Details match hasStorageAccess() (MDN: see that page for more).

  • No parameters — call it with empty parentheses (MDN).
  • Return value — a Promise that resolves to true or false (MDN).
  • Meaning — whether the document has access to third-party, unpartitioned cookies (MDN).
  • Relationship — new name for hasStorageAccess() (MDN).
  • Next step — if false, you may call requestStorageAccess() (MDN example).
  • ExceptionInvalidStateError if the Document is not yet active (MDN).

📝 Syntax

General form of Document.hasUnpartitionedCookieAccess (MDN):

JavaScript
hasUnpartitionedCookieAccess()

Parameters

None (MDN).

Return value

A Promise that resolves with a boolean value indicating whether the document has access to third-party cookies — true if it does, and false if not (MDN). See hasStorageAccess() for more details (MDN).

Exceptions

  • InvalidStateError — thrown if the current Document is not yet active (MDN).

MDN quick sample

JavaScript
document.hasUnpartitionedCookieAccess().then((hasAccess) => {
  if (hasAccess) {
    // storage access has been granted already.
    console.log("cookie access granted");
  } else {
    // storage access hasn't been granted already;
    // you may want to call requestStorageAccess().
    console.log("cookie access denied");
  }
});

⚡ Quick Reference

GoalCode
Feature-detecttypeof document.hasUnpartitionedCookieAccess === "function"
Check accessawait document.hasUnpartitionedCookieAccess()
Promise styledocument.hasUnpartitionedCookieAccess().then((ok) => { ... })
Wider fallbackdocument.hasStorageAccess || document.hasUnpartitionedCookieAccess
If deniedConsider document.requestStorageAccess() (MDN)
MDN statusLimited availability (not Baseline)

🔍 At a Glance

Four facts about document.hasUnpartitionedCookieAccess().

Returns
Promise

boolean

Args
none

MDN

Alias
hasStorageAccess

same idea

Status
Limited

not Baseline

📋 Name support vs capability

SituationWhat beginners usually seeTip
Chrome / Edge 125+Both method names often existEither name can run the same check
Firefox / SafariOften only hasStorageAccessFall back to the Baseline name
Top-level tutorial pageResult commonly trueInteresting cases are cross-site embeds
API boolean vs real cookiesCan disagree under user settingsSee accuracy notes on hasStorageAccess() (MDN)

Examples Gallery

Examples follow MDN Document: hasUnpartitionedCookieAccess() and practical alias / fallback patterns.

📚 Getting Started

Call the newer Storage Access method name.

Example 1 — MDN: then() branch

Classic MDN sample: granted vs denied messaging.

JavaScript
document.hasUnpartitionedCookieAccess().then((hasAccess) => {
  if (hasAccess) {
    console.log("cookie access granted");
  } else {
    console.log("cookie access denied");
  }
});
Try It Yourself

How It Works

On Chromium this often works. On Firefox/Safari you may need the hasStorageAccess() fallback shown later.

Example 2 — async/await form

Same check with modern async syntax.

JavaScript
async function checkAccess() {
  const hasAccess = await document.hasUnpartitionedCookieAccess();
  return hasAccess ? "granted" : "denied";
}

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

How It Works

Always await the Promise — the result is a boolean, but the API is asynchronous (MDN).

📈 Practical Patterns

Feature detection, cross-browser fallback, and alias comparison.

Example 3 — Feature-detect first

Guard against browsers that only ship the older name.

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

run();
Try It Yourself

How It Works

Limited availability means detection is not optional for production embeds.

Example 4 — Cross-browser helper

Prefer the Baseline name, then 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

MDN keeps hasStorageAccess() as a supported name with no removal plans. Leading with it maximizes reach; the newer name documents intent clearly.

Example 5 — Compare both aliases

When both exist, they should report the same access boolean.

JavaScript
async function compareNames() {
  const newer =
    typeof document.hasUnpartitionedCookieAccess === "function"
      ? await document.hasUnpartitionedCookieAccess()
      : "missing";
  const older =
    typeof document.hasStorageAccess === "function"
      ? await document.hasStorageAccess()
      : "missing";

  return { newer, older, same: newer === older };
}

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

How It Works

Useful for learning and debugging. For app logic, call one helper (Example 4) instead of both every time.

🚀 Common Use Cases

  • Readable Storage Access code — name that says “unpartitioned cookies” explicitly.
  • Chromium embeds — call the newer method when it is present.
  • Cross-browser widgets — fall back to hasStorageAccess() (Baseline).
  • API docs / teaching — show both names so learners recognize either in the wild.
  • Request flows — after false, consider requestStorageAccess() (MDN).
  • Defensive UX — still handle real cookie failures (see hasStorageAccess MDN notes).

🧠 How hasUnpartitionedCookieAccess() Works

1

Feature-detect the method

Confirm the newer name exists, or fall back to hasStorageAccess.

Detect
2

Call with no arguments

Ask whether unpartitioned third-party cookie access is available (MDN).

Call
3

Promise resolves to a boolean

true if access is indicated; false otherwise (MDN).

Result
4

Use cookies or request access

Proceed, or call requestStorageAccess() and still handle cookie errors.

📝 Notes

  • MDN: Limited availability (not Baseline).
  • Not Deprecated, Experimental, or Non-standard on MDN.
  • MDN: new name for hasStorageAccess(); see that page for more details.
  • MDN: part of the Storage Access API.
  • MDN: InvalidStateError if the Document is not yet active.
  • Related: hasStorageAccess(), hasFocus(), importNode().

Limited Browser Support

Document.hasUnpartitionedCookieAccess() is Limited availability on MDN (not Baseline). Support is mainly Chromium-based. Prefer hasStorageAccess() for wider reach. Logos use the shared browser-image-sprite.png sprite from this project.

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.

Conclusion

document.hasUnpartitionedCookieAccess() is the clearer, newer name for the Storage Access check that asks whether third-party unpartitioned cookies are already available. Learn it alongside hasStorageAccess(), which remains the Baseline-friendly entry point.

Continue with hasStorageAccess(), importNode(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect this Limited availability name
  • Fall back to hasStorageAccess() for Baseline reach
  • Branch on the Promise boolean (MDN)
  • Call requestStorageAccess() from a gesture when needed
  • Treat both names as the same Storage Access check (MDN)

❌ Don’t

  • Assume Firefox/Safari expose this newer name
  • Skip feature detection in production embeds
  • Confuse Limited availability with Deprecated
  • Forget cookie failures can still happen after true
  • Confuse this with Private State Token methods

Key Takeaways

Knowledge Unlocked

Five things to remember about hasUnpartitionedCookieAccess()

Newer name for the Storage Access cookie check.

5
Core concepts
🔄02

Args

none

MDN
🎯03

Alias

hasStorageAccess

same
04

Status

Limited

MDN
🛡05

Fallback

hasStorageAccess

Baseline

❓ Frequently Asked Questions

MDN: Document.hasUnpartitionedCookieAccess() 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 does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline) because some major browsers do not implement this newer name yet.
Yes. MDN: hasUnpartitionedCookieAccess() is a new name for Document.hasStorageAccess(). The older hasStorageAccess() name remains Baseline Widely available and is not planned for removal.
No. MDN: hasUnpartitionedCookieAccess() takes no parameters.
Prefer feature-detecting both names. For widest support today, call hasStorageAccess() when available, and fall back or also try hasUnpartitionedCookieAccess() in Chromium. Both describe the same check when present.
MDN example (shared with hasStorageAccess): storage access has not been granted already; you may want to call document.requestStorageAccess().
Did you know?

MDN says there are currently no plans to remove hasStorageAccess() in favor of hasUnpartitionedCookieAccess() — so both names can coexist in your mental model and your feature-detect helpers.

Next: importNode()

Learn how to copy nodes from another document into the current page with importNode().

importNode() →

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.

6 people found this page helpful