Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Necessity of User Gesture while accessing the storageAccessFor() api #244

Closed
sreek10 opened this issue Feb 1, 2024 · 3 comments
Closed

Comments

@sreek10
Copy link

sreek10 commented Feb 1, 2024

I was trying to use the demo mentioned in the related website sets document and implement the same for two of my websites with medscape.com and medscape.org where .com is the primary and later is the associated one.
Every time I initiate the demo using CLI I see the permission is prompt and I have to add a user gesture like button click.

Is there anyway to avoid the same as user gesture for our sites are not possible to integrate and I saw there is one way to avoid the user gesture.

When I tried the mentioned way I am still getting the permission as prompt and user gesture is required to move forward.

Can you please help here.
Thank you

@cfredric
Copy link
Collaborator

cfredric commented Feb 1, 2024

Hi @sreek10,

I'm not sure what advice you saw for avoiding the need for a user gesture, but Chrome intentionally requires a user gesture for the first call to document.requestStorageAccessFor(origin) and/or the first call to document.requestStorageAccess(). Chrome does not provide a way to avoid it.

However, the user gesture is unnecessary for subsequent calls, after the first one.

@cfredric cfredric closed this as completed Feb 1, 2024
@sreek10
Copy link
Author

sreek10 commented Feb 1, 2024

Screenshot 2024-02-01 at 12 11 04

Please find the above screenshot, it says the prompt can be avoided. Can you please advise.
Thank You

@cfredric
Copy link
Collaborator

cfredric commented Feb 1, 2024

I saw there is one way to avoid the user gesture.

Please find the above screenshot, it says the prompt can be avoided. Can you please advise.

A prompt and a user gesture are different things.

  • A user gesture is an action that the user did, like a click or a keypress.
  • A prompt is a piece of browser UX that asks the user for permission to do something. The user can accept, deny, or dismiss the prompt.

It is possible to avoid the need for a prompt (in Chrome) if all of the sites involved are in the same RWS.

It is not possible to avoid the need for (at least one) user gesture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants