JavaScript 粘贴和多个剪贴板级别
在网上搜索并尝试在 Opera 浏览器上使用 javascript 进行粘贴的一些不成功的经验之后,我想问:
1)有没有一种方法可以在 javascript 中进行粘贴,同时适用于 Opera 和 Firefox/Mozilla?
2)如果我能达到更多级别的剪贴板,那将非常有用。我解释一下:我使用另一个应用程序复制“第一个文本”和“第二个文本”之后。当我切换到浏览器时,通过某种机制(参数、变量等),我可以访问最后粘贴的文本、最后粘贴之前的文本等。我还想访问任何剪贴板级别的文本,而无需将其粘贴到某处。
我不知道这些功能是否可行,对于一个不太了解 javascript 世界的人来说,它们似乎可能在某种程度上受到操作系统/桌面环境甚至 javascript/DOM 功能的限制。
提前致谢。
After searching the Internet and doing some unsuccessful experiences trying to do paste using javascript on the Opera browser, I want to ask:
1) Is there a way I can do paste in javascript that works both on Opera and Firefox/Mozilla?
2) It would be very useful if I could reach more levels of clipboard. I explain: I use another application to copy "First text" and after "Second text". When I switch, to the browser, through some mechanism (a parameter, a variable, etc.) I could get access to the last-pasted-text, the before-the-last-pasted-text and so on. I would also like to reach the text of any clipboard level without the obligation of pasting it somewhere.
I don't know if those functionalities are possible and, for a person that is not very much into the javascript world, it seems they may be constrained to some extent by the operating system / desktop environment or even by javascript/DOM capabilities.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于你的第一个问题,你必须使用Flash,我不相信你可以单独使用Javascript来为所有浏览器做到这一点。允许访问用户剪贴板存在一点安全漏洞。
该项目使用 Flash 和 Javascript 来实现:
http://code.google.com/p/zeroclipboard/< /a>
对于第二个,我认为这是不可能的。某些操作系统(或其窗口管理器)支持多级复制和粘贴。我记得 Ubuntu 上的 Gnome 可以,但 Windows 上不行。
For your first question, you have to use Flash, I don't believe you can do it with Javascript alone for all browsers. It's a little bit of a security flaw to allow access to the users clipboard.
This project does it with Flash and Javascript:
http://code.google.com/p/zeroclipboard/
For the second, I don't think this is possible. Some operating systems (or their window managers) support multiple levels of copy and paste. I seem to remember that Gnome on Ubuntu does, but not Windows.
Zeroclipboard 在 code.google.com 中不可用,
您可以从 ZeroClipBoard 网站。
Zeroclipboard is not available in code.google.com
You can access the same from ZeroClipBoard website.