Javascript Copy To Clipboard on safari?

前端 未结 7 952
执念已碎
执念已碎 2020-12-10 02:30

It may be duplicate question but i didnt find the solution for this.

I am trying to copy text on button click. Its working on chrome, mozilla(working on on windows a

7条回答
  •  鱼传尺愫
    2020-12-10 03:13

    I had the same problem - it turned out my issue was caused because I was creating a temporary select element to copy the text from, which is fine, but I was also hiding it via various methods, the culprit being element.style.width = 0. Removing that and using other methods to hide it solved my issue.

    Hope this helps anyone running into the same problem.

提交回复
热议问题