使用 Javascript 访问剪贴板 - 没有 Flash? [英] Clipboard access using Javascript - sans Flash?

查看:28
本文介绍了使用 Javascript 访问剪贴板 - 没有 Flash?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种可靠的方法可以使用 Javascript 访问客户端计算机的剪贴板?尝试执行此操作时,我继续遇到权限问题.Google 文档如何做到这一点?他们使用 Flash 吗?

Is there a reliable way to access the client machine's clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use Flash?

我的主要目标是 IE8,但也希望支持 FF 和 Chrome.

My primary target is IE8, but would like to support FF and Chrome also.

我已经看到使用 Flash 执行此操作的技术,但我正在寻找纯 js 路由:
使用 Flash 访问剪贴板

I have seen the technique to do this using Flash, but am looking for a pure js route:
Clipboard access using Flash

推荐答案

由于这是一个很大的安全风险,所有关心安全的浏览器都不允许 JS 访问剪贴板.

Since this is a big security risk, all browsers that care about safety don't allow JS to access the clipboard.

主要原因是很多人将密码放入文本文件中,然后使用剪切和粘贴来登录.然后,破解者可以通过破解一个流行网站并安装一些 JS 向他们发送剪贴板内容,从剪贴板收集密码(可能还有其他私人信息,如您刚刚复制的 word 文档).

The main reason is that many people put their passwords into a text file and then use cut&paste to login. Crackers could then collect the password (and possibly other private information like the word document which you just copied) from the clipboard by cracking a popular site and installing some JS that sends them the content of the clipboard.

这就是我一直禁用闪光灯的原因.

Which is why I have flash disabled all the time.

这篇关于使用 Javascript 访问剪贴板 - 没有 Flash?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆