+ 1
How can I add functions to the Copy and Cut buttons?
8 ответов
+ 5
Remember the w3 example works only on input elements
+ 4
Here you go
https://code.sololearn.com/WiCveHSYxuzq/?ref=app
+ 3
You want to copy text to the clipboard of the user?
Maybe these help you:
https://www.w3schools.com/howto/howto_js_copy_clipboard.asp
https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
+ 3
... and not on all browsers 😉
+ 2
Yeah, ran into this exact issue when I was putting together something to help a client copy/paste blockchain/cryptocurrency addresses. I thought this was a somewhat reasonable explanation geared toward non-technical folks:
"[...] interactive sites that use Web code (in particular, one called JavaScript) to look and act like programs installed directly on your computer, and a standard security precaution in browsers that blocks Web code from any access to the system clipboard.
Why lock them out? Your computer can't tell the difference between a JavaScript-driven action that you took, such as clicking a button in a Web app, and one that a website executed on its own and without your consent. And it's a lot easier to find yourself on a malicious website than to install malicious software on your Mac or PC."
(citation: https://www.usatoday.com/story/tech/columnist/2014/04/13/copy-and-paste-in-google-docs/7568661/ )
+ 1
Its not so easy because different "standards" and different behaviours
https://dzone.com/articles/cross-browser-javascript-copy-and-paste
0
yes
0
And cut?