react-youtube icon indicating copy to clipboard operation
react-youtube copied to clipboard

Uncaught DOMException: Failed to construct 'PresentationRequest': The document is sandboxed and lacks the 'allow-presentation' flag

Open maxweb4u opened this issue 2 years ago • 9 comments

I have this mistake when installed latest version: 10.1.0

error

react-youtube: v10.1.0 react: 17.0.2

maxweb4u avatar Nov 22 '22 20:11 maxweb4u

Experiencing this too, same setup pretty much. I found this issue/fix on a different package which may help get this resolved.

Ojay avatar Nov 28 '22 11:11 Ojay

Yes

Experiencing this too, same setup pretty much. I found this issue/fix on a different package which may help get this resolved.

yes I found this fix too, but it's on another package. And react-youtube doesn't provide an ability to add 'sandbox' property. So how could I add 'allow-presentation' to the sandbox for react-youtube.

maxweb4u avatar Nov 28 '22 13:11 maxweb4u

It was more posted for the devs to reference if/when they get to fixing it for this package. Unfortunately I don't think its possible to apply allow-presentation to react-youtube as is... 😕

Ojay avatar Nov 28 '22 14:11 Ojay

The YouTube iframe API already adds the sandbox attribute. Not sure we we should mess with it 👀

ruisaraiva19 avatar Nov 28 '22 14:11 ruisaraiva19

sandbox seems to add allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox The error is about allow-presentation which is missing.

yshterev avatar Nov 30 '22 12:11 yshterev

adding player.h.attributes.sandbox.value = "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-storage-access-by-user-activation allow-presentation"; adds allow-presentation but does not solve the problem image

rnrajurkar avatar Dec 07 '22 10:12 rnrajurkar

Yes, iframe has allow-presentation but error still appears in console

oknaus-huemor avatar Dec 16 '22 06:12 oknaus-huemor

Does anyone fixed this yet ? I got same error...

RexHung0302 avatar Dec 21 '22 07:12 RexHung0302

Having the same issue. The Options type coming from dist/youtube-player appears to be incomplete. Would it be possible to extend this type and add support for adding our own sandbox attributes? If contributions are welcome, I would be happy to raise a PR for this. It doesn't affect functionality, but all that red in my console bothers me.

joshuagraber avatar Jan 23 '23 12:01 joshuagraber