execCommand('copy') does not work in Ajax / XHR callback?

后端 未结 2 1448
鱼传尺愫
鱼传尺愫 2020-12-10 15:45

(Tested using Chrome 44)

Desired behaviour: Make XHR request, put result in text area, select text, and copy to clipboard.

Actual be

2条回答
  •  借酒劲吻你
    2020-12-10 16:11

    You can only trigger a copy to the system clipboard in direct response to a trusted user action, such as a click event.

    Spec: http://www.w3.org/TR/clipboard-apis/#integration-with-rich-text-editing-apis

提交回复
热议问题