无法获得execCommand('粘贴')在Chrome中工作 [英] Can't get execCommand('paste') to work in Chrome

查看:199
本文介绍了无法获得execCommand('粘贴')在Chrome中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的扩展名遇到了问题。我环顾四周,发现我必须做的事情,我无法完成工作。



到目前为止,我已经:



$ p $ function pasteAndGo()
{
document.execCommand('粘贴')
alert(粘贴 )
}

警报出现,但没有任何内容被粘贴。



我感觉它是需要改变的文档部分,但我找不到。

解决方案

你不能在常规页面上执行它,只能在后台页面中执行。


I've hit a problem with my extension. I've looked around and found what I have to do, I just can't get it to work.

So far, I've got:

function pasteAndGo()
{
    document.execCommand('paste')
    alert("Pasted")
}

The alert comes up, but nothing has been pasted.

I've got a feeling it's the document part that needs changing, but I can't find what.

解决方案

You can't execute it on a regular page, only in a background page.

这篇关于无法获得execCommand('粘贴')在Chrome中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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