Clipboard.js 不在 Safari 或 Firefox 中复制

Clipboard.js not copying in Safari or Firefox

Clipboard.js 在 Chrome (v50.0) 中运行良好,但不会在 Firefox (v46.0) 上复制文本。

clipboard.on('error', function(e){...}) 被抛出,v41+ 支持 clipboardjs,但错误除了提供单击了哪个按钮外没有提供任何信息触发复制。

知道这里会发生什么或者我能做什么吗check/try?

文档中说 Safari 不支持它

Although copy/cut operations with execCommand aren't supported on Safari yet (including mobile), it gracefully degrades because Selection is supported.

That means you can show a tooltip saying Copied! when success event is called and Press Ctrl+C to copy when error event is called because the text is already selected.

For a live demonstration, open this site on Safari.

要获取有关点击内容的信息,请检查触发器

clipboard.on('error', function(e) {
    console.error('Action:', e.action);
    console.error('Trigger:', e.trigger);
});