[英]How to copy text to clipboard via custom context menu (without flash / add-ons)
My understanding is that there is no cross browser * solution for setting the text of system clipboard directly, instead, on a keyboard initiated copy event, setting text to the system clipboard can be accomplished by setting focus to a hidden text input on keypress just prior to the copy event. 我的理解是,没有跨浏览器 *直接设置系统剪贴板文本的解决方案,相反,在键盘启动的复制事件中,可以通过将焦点设置为键盘上输入的隐藏文本来完成将文本设置为系统剪贴板的操作复制事件。
With 'copy' from custom context menu, there is no user-initiated copy event to be directed towards the hidden input. 通过自定义上下文菜单中的“复制”,没有用户启动的复制事件将被定向到隐藏的输入。
In Google docs, however, right click opens a custom context menu, where the user can copy the selected text to the system clipboard. 但是,在Google文档中,右键单击会打开一个自定义上下文菜单,用户可以在其中将所选文本复制到系统剪贴板。 How can this result be achieved? 如何获得这个结果?
There is no cross browser way around for accessing system clipboard without flash. 没有跨浏览器的方式就可以访问没有闪存的系统剪贴板。 Clipboard is a security-relevant resource since it could contain sensitive data. 剪贴板是与安全性相关的资源,因为它可能包含敏感数据。
You can find more info in this blog post : 您可以在此博客文章中找到更多信息:
http://brooknovak.wordpress.com/2009/07/28/accessing-the-system-clipboard-with-javascript/ http://brooknovak.wordpress.com/2009/07/28/accessing-the-system-clipboard-with-javascript/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.