demo · v152

Migration Lab

The recommended replacement for requestStorageAccessFor is to call requestStorageAccess() from inside the embedded iframe instead of from the top-level. This page runs both shapes against the same target and shows what each returns.

legacy — requestStorageAccessFor (top-level call)

document.requestStorageAccessFor(origin)

not run.

modern — requestStorageAccess (inside iframe)

iframe.contentDocument.requestStorageAccess()

not run.
// Legacy — being removed in Chrome 152
await document.requestStorageAccessFor("https://embedded.example");

// Modern — call from inside the iframe instead
// (in iframe context, after a user gesture)
const granted = await document.requestStorageAccess({ all: true });

what changes for your code

The migration is not a one-line rename. requestStorageAccessFor was designed for non-iframe use cases — same-page top-level requests on behalf of a known embedded site. The replacement requires that the third-party context exist (an iframe) and that the gesture happen there. Sites built on the rSAFor ergonomics need to re-architect to embed the third party before requesting access.

see also