我試圖使用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 –