javascript - FireFox document.exeCommand('copy') not working -


i have following code :

   var doc = window.document;    var copyfrom = doc.createelement("textarea");    copyfrom.textcontent = str;    var body = document.getelementsbytagname('body')[0];    body.appendchild(copyfrom);    copyfrom.select();    document.execcommand('copy');    body.removechild(copyfrom); 

this seems work fine on chrome able paste contents on 'str' variable. doesn't seem work on firefox/safari.

safari not give clipboard access without user generated event. user initiated actions ( e.g ctrl + c/ cmd + c) can work copy items.

about firefox, can give details regarding version. there has been change post 44.0 copy clipboard has been enabled.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -