In Safari desktop document.execCommand('copy')
doesn't work, so I'm struggling with adding a text in the clipboard on Cmd+C key press
What I tried is to catch Cmd+C combination on keydown
event and do the following:
- create a hidden input with text I want to put in clipboard
- set focus to the input
- select the text in the input
but text is not copied to clipboard. This works however on Chrome for example.
The following question says it's not possible but I see apps like draw.io
and others doing it, so there has to be a way: