我试图使用execcommand("paste")
将剪贴板数据粘贴到textarea中,但是我似乎无法使其工作。 权限已设置。 我试图在textarea上设置focus()
,但document.execCommand("paste")
什么都不做,我没有任何错误。 从背景页面调用execcommand("paste")
也什么都不做。在Chrome扩展中正确使用execcommand(“粘贴”)
<form>
<textarea id="ta"></textarea>
</form>
<script type="text/javascript">
document.findElemetById("ta").focus();
document.execCommand("paste");
</script>
小观察工作,但你的意思'document.getElementById'为'document.findElementById'不存在?我确定这不是真正的代码问题,因为这肯定会导致错误。 – Alasdair
也看到这个问题:http://stackoverflow.com/questions/6969403/cant-get-execcommandpaste-to-work-in-chrome/7100464#7100464 –