Storage Access API

The Storage Access API lets a cross-site iframe ask for its unpartitioned cookies. These are the cookies the site has when the user opens it in a top-level tab.

Browser API

Also called requestStorageAccess

Updated

On this page

How it works

In many browsers, a cross-site frame gets no third-party cookies, or only a partitioned copy. The frame calls document.requestStorageAccess() after a click or a tap. If the browser grants access, the promise resolves. If not, it rejects with a NotAllowedError.

The browser stores the grant for the pair of the top-level site and the frame's site. After the grant, the embed must reload itself. The browser then sends the cookies with the new requests. document.hasStorageAccess() tells the frame if it has access already.

Browser rules

BrowserWhen the browser shows a prompt
SafariFor each embed that did not get access before
FirefoxOnly after an origin asked for access on more than a set number of sites
ChromeFor each embed that did not get access before

In October 2025, Google said that Chrome will remove Related Website Sets. Do not count on a set to skip the prompt.

A grant expires after 30 days. The exact rule is different in each browser. The storage-access Permissions-Policy directive also controls if a frame may use the API.

Example

JavaScript in the iframe
button.addEventListener("click", async () => {
  if (await document.hasStorageAccess()) return;
  await document.requestStorageAccess();
  location.reload();
});

The request must come from a click or a tap. After the grant, reload the frame so the requests send the cookies.

How to use it

Call requestStorageAccess() from a click in the frame. If the frame has a sandbox, the parent must add three tokens.

async function askForCookies() {
  if (await document.hasStorageAccess()) return true;
  try {
    await document.requestStorageAccess();
    location.reload();
    return true;
  } catch {
    return false; // denied: open the site in a new tab
  }
}

Cookies still need SameSite=None and Secure. Chrome treats a cookie with no SameSite as Lax.

Learn more

Sources

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.