1
I would like to paste a text from the clipboard using javascript, is not an extension is a web page.
I tested the command document.execCommand('Paste')
in some ways didn’t work out, I’m using Google Chrome.
1
I would like to paste a text from the clipboard using javascript, is not an extension is a web page.
I tested the command document.execCommand('Paste')
in some ways didn’t work out, I’m using Google Chrome.
2
The command document.execCommand('Paste')
cannot be executed in normal pages only in background pages, which are extension pages.
Case doubts about backgorund pages: https://developer.chrome.com/extensions/background_pages
A common need for Extensions is to have a single long-running script to Manage some task or state. Background pages to the Rescue. I think this has more to do with Chrome extensions than with web pages
yes, this type of command is authorized only by the.
You’re right, I hadn’t seen that in your reply. Reading error =)
I just added this part "which are extension pages." to make it clearer.
0
The command document.execCommand('paste')
has never been a stable Javascript command. It was a temporary solution created to help developers program in the version Chrome Dev and is apparently part of the API for Chrome extensions.
She was removed from Firefox for security reasons and apparently only the commands Cut and Copy work in Chrome, even to work it is necessary that the user has selected a part of the page text. The command Paste always returns false
because it is never possible to execute it.
Browser other questions tagged javascript html google-chrome
You are not signed in. Login or sign up in order to post.
I really don’t understand how browsers are allowing access to things as surreal and insecure as knowing what the user has in the memory of the Clipboard. This is going to be serious trouble.
– Brunno Vianna
The duplicate answers yes to the question. Excerpt from one of the answers: Basically, you can’t access clipboard content on most browsers. Because, obviously, this is considered a security problem
– Jefferson Quesado