---
title: "Ask before embedded content uses cookies · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/privacy/storage-access-api
updated: 2026-10-20
licence: "All rights reserved"
---

# Ask before embedded content uses cookies

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Optional
- Chapter: [Privacy](https://agentwranglers.se/playbook/website/privacy)
- Rule: If embedded content needs its own cookies, ask for them with the Storage Access API. Don't rely on third-party cookies.
- How: In the embedded page, call `document.requestStorageAccess()` after a click or tap, when it needs its own cookies. Browsers only allow the call after a user action, and may show a prompt.
- Check: In a browser that blocks third-party cookies, the embed shows a button first. After a click, it shows the signed-in view.

Example:

```js
// Runs inside the embedded page, e.g. widget.example.com
button.addEventListener('click', async () => {
  if (!(await document.hasStorageAccess())) await document.requestStorageAccess();
  loadSignedInView();
});
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/privacy/storage-access-api`.

- Previous: [Host everything yourself for privacy](https://agentwranglers.se/playbook/website/privacy/third-party-scripts)
- Next: [Count visits without tracking people](https://agentwranglers.se/playbook/website/privacy/analytics-privacy)
- [Privacy](https://agentwranglers.se/playbook/website/privacy)
