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

Clipboard API example iframe - permission policy error #35862

Closed
RyanFarrah67 opened this issue Sep 12, 2024 · 6 comments · Fixed by #35928
Closed

Clipboard API example iframe - permission policy error #35862

RyanFarrah67 opened this issue Sep 12, 2024 · 6 comments · Fixed by #35928
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@RyanFarrah67
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read#examples

What information was incorrect, unhelpful, or incomplete?

The examples set in the Clipboard API don't work, when copying an image as indicated in the doc to paste it, nothing happens, only errors are thrown.

These demos are presented through an Iframe which causes permission policy issues.

What did you expect to see?

The examples are to work correctly when copying and pasting the image and no errors are to be thrown.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

OS

Linux Ubuntu 22.04

Browsers

Google Chrome

127.0.6533.72

The error appears in the DevTools console and the iframe.

Capture d’écran du 2024-09-12 22-40-41

Firefox

130.0

The error appears directly in the Iframe itself Error: Clipboard read operation is not allowed.

MDN metadata

Page report details
@RyanFarrah67 RyanFarrah67 added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 12, 2024
@github-actions github-actions bot added the Content:WebAPI Web API docs label Sep 12, 2024
@RyanFarrah67
Copy link
Author

I didn't see it as it is not present in all examples but there is a note about Chromium browsers :

This may not work on chromium browsers as the sample frame is not granted the Permissions-Policy clipboard-read and clipboard-write permissions (required by Chromium browsers).

However, I let this issue open as the problem is also in Firefox.

@hamishwillee
Copy link
Collaborator

Are you sure? This is what I see on Firefox

image

Permission-Policies are supposed to first be set by the server and then that subset can be granted if also set on the frame. Firefox doesn't care about the server so we are able to set the permissions just on the frame.

@RyanFarrah67
Copy link
Author

This is what I get :

image

Strangely, the first left click on the second box does nothing, I need to click a second time for the error to appear.

@hamishwillee
Copy link
Collaborator

Can you please try pressing Play and seeing what happens if you run it using the playground?

@RyanFarrah67
Copy link
Author

RyanFarrah67 commented Sep 16, 2024

image

The same, I don't see any error in the console.

@hamishwillee
Copy link
Collaborator

Thanks @OnkarRuikar !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants