Can't paste the text from buffer to Chrome extension popup
Tried to make an extension with a te开发者_StackOverflow社区xtarea in popup. But something seems wrong cause I can't paste with ctrl+v
shortcut copied before text in this textarea :(
What can be wrong with it? I already have some extensions installed and there is a possibility to paste the text in the textarea.
Maybe I need to do some magic to enable the paste?
Original, the textarea is created simply with document.createElement('textarea')
, but I tried to create it in html code. The same result :(
Thank you for any assumption.
Take a look at the ChromE.Experimental.Clipboard API.
Found a solution.
'Tis strange, but the rule
body > div {
display: none;
}
blocked the paste possibility. Don't know why O.o
Just add this sample into to project and check it!!!
<body>
<script>
var createdElement = document.createElement('textarea');
document.body.appendChild(createdElement)
</script>
</body>
There is no code problem. May be u can check up css or js for blocking Ctrl+v or paste in your project
like
function setClipBoardData(){
setInterval("window.clipboardData.setData('text','')",20);
}
<body onload="setClipBoardData();">
or some other methods. I hope its help to you ...
精彩评论