Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox - document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler

Tags:

I am developing a single-page app, I have a button on the page, when a user clicks the button I would like to make an ajax call to my server, and then copy the returned value (via callback) to the user's clipboard.

Each component works in isolation, but when I glue them together Firefox returns the following error:

document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler

I would like to know the specifics of this error, but there is absolutely no information online; what are the limiting conditions that trigger this error, is it a stack depth, a timeout, etc?

like image 981
mils Avatar asked Dec 12 '16 04:12

mils


2 Answers

on firefox it only work with click handler, reference Interact_with_the_clipboard

like image 170
uingtea Avatar answered Oct 03 '22 10:10

uingtea


Firefox will display the same error message if the manifest is missing the clipboardWrite permission.

like image 33
fred02138 Avatar answered Oct 03 '22 10:10

fred02138