0

In an iframe that is from a different origin than its parent, I want to optionally display a 'copy' button if I detect that the iframe has clipboard-write permission. How do I check within the iframe if it has that permission?

I thought I could use Window.frameElement, get the iframe, and check its attributes to do so. However, Window.frameElement gives null, because "the document into which it's embedded has a different origin" - https://developer.mozilla.org/en-US/docs/Web/API/Window/frameElement

Wes
  • 894
  • 1
  • 7
  • 17
  • you can not access an iframe in a different domain, not much you can do. – epascarello Sep 30 '22 at 20:07
  • Related question: [Can text within an iframe be copied to clipboard?](https://stackoverflow.com/questions/61401384/can-text-within-an-iframe-be-copied-to-clipboard) – Yogi Sep 30 '22 at 21:43
  • @epascarello, thank you. I'll see what I can manage. – Wes Oct 03 '22 at 16:12

0 Answers0