How to simulate a CTRL + V with javascript [duplicate]

1

I would like to paste a text from the clipboard using javascript, not an extension is a web page.

I tried the document.execCommand('Paste') command in some ways but it did not work, I'm using Google Chrome.

    
asked by anonymous 28.09.2017 / 17:02

2 answers

2

The document.execCommand('Paste') command can not be run on regular pages only on background pages, which are extension pages.

If you have questions about backgorund pages: link

    
28.09.2017 / 19:18
0

The document.execCommand('paste') command has never been a stable JavaScript command. It was a temporary solution designed to help developers program in the Chrome Dev version and apparently is part of the API for Chrome extensions .

She has been removed from Firefox for security reasons and apparently only Cut and Copy work in Chrome, even if they work, the user must have selected part of the page text. The Paste command always returns false because it can never be executed.

    
28.09.2017 / 20:51