document.execCommand('copy') not working on Chrome

前端 未结 3 1189
遇见更好的自我
遇见更好的自我 2021-02-19 17:10

On Chrome only document.execCommand(\'copy\') returns true but does not copy the text, it clears the clipboard.

I can\'t find anyone who\'s had the same pro

3条回答
  •  忘掉有多难
    2021-02-19 17:26

    I have found that you can't dynamically insert a input field, insert some text, and then copy it to the clipboard. I was able to copy text from an existing input tag.

提交回复
热议问题