下面是我“复制到剪贴板”的代码,除了不能在 safari 浏览器上运行外,一切正常...请帮忙
<textarea id="mcq1" style="width:1px; height:1px; opacity:0; position:absolute;">
<iframe src="http://s.rabblerapp.com/widget/widget.php?raw_uuid=de8c6880-9624-4b1d-8905-a3e2ab290660" style="width:100%;height:635px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"></iframe>
</textarea>
<button class="rb_mcqbtn btn" data-clipboard-action="copy" data-clipboard-target="#mcq1" onclick="show_area('copied');">Copy Embed Code</button>
这是我为此使用的 javascript... https://zenorocha.github.io/clipboard.js
最佳答案
我看了他们的网站..
看这里:link
This library relies on both Selection and execCommand APIs. The second one is supported in the following browsers.
images here.....
Although copy/cut operations with execCommand aren't supported on Safari yet (including mobile), it gracefully degrades because Selection is supported.
关于javascript - 复制到剪贴板在 safari 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34254318/