Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » JS Bookmarklet to Copy a Unicode character to clipboard
- 1132262
-
1000+ posts
JS Bookmarklet to Copy a Unicode character to clipboard
I'm wondering how I could make a bookmarklet that, when clicked, copies the U202A character to my clipboard (No, not for collaborative text-editing rap battles. I promise.)
I've looked, and there doesn't seem to be an intuitive way to do this. All the APIs I've seen use HTML elements as input.
Any suggestions?
Mod: (Removed a link - I love xkcd but we do need to keep language all-ages, sorry. :( )
I've looked, and there doesn't seem to be an intuitive way to do this. All the APIs I've seen use HTML elements as input.
Any suggestions?
Mod: (Removed a link - I love xkcd but we do need to keep language all-ages, sorry. :( )
Last edited by Harakou (May 10, 2020 18:25:03)
- Sheep_maker
-
1000+ posts
JS Bookmarklet to Copy a Unicode character to clipboard
You could try navigator.clipboard.writeText:
It's possible that it can only be run in certain event handlers like in a click event listener, but this depends on the browser
navigator.clipboard.writeText('\u202a')
- 1132262
-
1000+ posts
JS Bookmarklet to Copy a Unicode character to clipboard
navigator.clipboard.writeText:Thanks! You could tryIt's possible that it can only be run in certain event handlers like in a click event listener, but this depends on the browsernavigator.clipboard.writeText('\u202a')
:)
Last edited by 1132262 (May 10, 2020 18:50:03)
- Discussion Forums
- » Advanced Topics
-
» JS Bookmarklet to Copy a Unicode character to clipboard