因为navigator.clipboard只能在https下使用,那使用ClipboardJS第三方库能在http下能将图片复制到剪切板上?
因为navigator.clipboard只能在https下使用,那使用ClipboardJS第三方库能在http下能将图片复制到剪切板上?
ClipboardJS 只能把一些内容复制到粘贴板吧,所以用到的并不一定是 navigator.clipboard 这个API。
从项目仓库中也可以看到并没有使用 navigator.clipboard
,而是使用了 document.execCommand
,document.execCommand 现在依旧被个浏览器所支持,并且不会受限于HTTPS.
另外这个仓库也有过使用 navigator.clipboard
替换 document.execCommand
的讨论 👉 Use the Clipboard API instead of execCommand · Issue #770 · zenorocha/clipboard.js。
当然可以:
![上传中...]()