How do you read content from the clipboard

i've tried:
navigator.clipboard.read().then
Clipboard.readText()
navigator.clipboard.readText();

i want to make a block that can get text from the clipboard

Weird, I tried using all three as a javascript: (code) thing in the URL box, but only the first and last one came back as a result. I did both javascript: var a=(code); alert(a) and javascript: alert((code)), but they both did this
image

This works for me

var done = false, thing = null
if("clipboard" in navigator) {
  navigator.clipboard.readText(thing).then(x => {thing = x; done = true})
} else {alert("I can't retrieve thing from clipboard."); done = true}

return new List([function() {return done}, function() {return thing}])

This doesn't give you a result immediately, so you have to do this

(You can name the var anything)

Here's the project: Snap! Build Your Own Blocks

Note: this doesn't work in all browsers, but I know it works in chrome.

This is why Jens hasn't added a feature for it.

You have to make ur script have access to window globe mb

And it seems as if the Firefox people have decided that it will only work in extensions:Clipboard: read() method - Web APIs | MDN

I believe there are privacy concerns since some people (like me) might copy and paste a password (or other private data) and forget to remove it from the clipboard.

Yeah, I can see that happening.

But- but why?

convenience obviously

Regardless of the bizarre logic used in this sentence
"Firefox only supports reading the clipboard in browser extensions, using the 'clipboardRead' extension permission"
it only means that extensions need extra permission ("clipboardRead"), in the manifest, to use the clipboard.read().

Desktop browsers require just a few flags set with "about:config" .

Because we don't know our passwords for different web sites, but instead use a password manager to create and remember them, then copy-paste from the password manager to the site where we're trying to log in.

I use keeppassxc (because it's free and open source), which has an auto type feature, which I sometimes use. I usually just use their browser extension though (in communicates with the password manager to allow me to not have to use the auto type)

* laughs in chrome (and firefox does it too!) *

Using a password manager (not built into the browser) is usually more secure. There's actually a program out there that can extract the passwords from chrome and firefox (but for firefox, you need to input a password if you set a password). I used that to export all my passwords (although, I did have to turn off my antivirus to use it).

no, really? I thought the internet was the safest place in the world!

I don't install any sus programs, and when I do install programs, I check reviews, articles on it, etc

And passwords on the clipboard is only an example. Most people copy and pastes all sorts of private information - maybe, for example, to send to a relative some news another relative revealed in an email. Or my bank issued me a user id that is 2 letters and 8 digits that I can't change and need to log in so it is frequently on my clipboard.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.