Privacy Optional
Ask before embedded content uses cookies
If embedded content needs its own cookies, ask for them with the Storage Access API. Don't rely on third-party cookies.
How to do it
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.
Example
// Runs inside the embedded page, e.g. widget.example.com
button.addEventListener('click', async () => {
if (!(await document.hasStorageAccess())) await document.requestStorageAccess();
loadSignedInView();
});
How to check
In a browser that blocks third-party cookies, the embed shows a button first. After a click, it shows the signed-in view.
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.