-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Is there a way to detect if a page was loaded with storage access restricted by sandboxing?
Context: we recently started using the Storage Access API for authenticated embeds of content from our site in other sites, including an embed API that can be used by third-parties to embed Lucid documents in their sites.
However, if the host site sandboxes the iframe and doesn't include allow-storage-access-by-user-activation, the experience is quite bad: we show the user our "allow cookies" page, but when they click our button it immediately fails. So we tell them to try logging in to Lucid in a new tab (in case it was blocked due to the top-level-interaction requirement in Chrome/Safari), but when they do that and try again, it's still blocked, and the only workaround is for the user to turn off third-party-cookie-blocking altogether in their browser settings.
From our API's perspective, this situation isn't the user's fault at all, it's the host site's fault. Ideally we'd be able to detect this scenario and (1) inform the owner of the host site that they need to add the sandbox flag to use our API and (2) inform the user that the host page is misconfigured and offer a workaround.
What I've tried:
navigator.permissions.query({name: 'storage-access'})-> returnsprompteven when sandbox disallows itdocument.featurePolicy.allowsFeature('storage-access')-> returnstrueeven when sandbox disallows it
Any help here would be much appreciated.