Using clipboard from web-plugin

  • 17 August 2020
  • 3 replies

I’m trying to create a web-plugin component that uses a library component (miro.board.ui.openLibrary) that tries to capture events (change or paste) events so the user can paste data into the component.  In the event, I am trying to access navigator.clipboard.readText().  It fails on this line with the following error in chrome: 

Uncaught (in promise) DOMException: Disabled in this document by Feature Policy.

It would seem that access to the clipboard is not allowed within a web-plugin? If it is allowed, is there something specific I need to do to enable it?


Best answer by Ahmed El Gabri 20 August 2020, 10:14

View original

3 replies

After further troubleshooting, I found that the event.clipboardData object will work.  It looks like the newer ‘navigator.clipboard’ object is blocked.


input.addEventListener("paste", event => pasteData(event))


function pasteData(e) {

   var pastedText = e.clipboardData.getData('Text');


   return false; // Prevent the default handler from running.


Hi @Mike Hatch,


Unfortunately Chrome currently doesn’t allow accessing clipboard inside an iframe with feature policy. There is a fix that was merged in Chrome already to add support for this but according to this comment it will not be available before August 25th. So we will check later when the new version of Chrome is released.




Thanks @Ahmed El Gabri.  As noted above, I was able to get it working within a sidebar using the event data vs. a call to the navigator object.  So it is possible...