How to automatically access the Clipboard

Hi there,

I would like to build an extension that automatically receive the Clipboard on new event.
Then I can log it to the console for testing.

I’m not asking on click or select or any other browser event, I’m saying without doing nothing.
I would like the plugin to receive the Clipboard when I make a copy from anywhere in the OS.

Thanks.

1 Like

I’m keen to delve deeper into this plugin as it consistently proves highly beneficial to me. Given the frequent need to copy content from various sources of new heights, I find it indispensable.

2 Likes

I’m actually developing it and it will be available soon. Then you’ll let me know what you think.

1 Like

I think it’s an AI bot message that got liked by two other spam AI accounts :smiley:, it’s crazy.
And when you combine it with bad English and bad message content, it’s like triple red flag.

Anyway, I wonder though, is there some event that fires when you put something to the clipboard?

1 Like

Oh, and who would be the Ai here @alicemichale or me? :grinning:
Or even stronger, maybe it’s @juraj.masiar trying to divert suspicion from the start. :laughing:

Hi guys,

I finally made it!

The Clipboard API allows access from a background script, but cannot listen to change events. To listen for change events, we need to use a content script and add an event to the page. In my case, I didn’t want to inject content.js on every page just for this purpose, so I adopted the setInterval() approach which, unlike content.js, will allow me to get a new clipboard entry from any origin.

The goal of all this was to share the clipboard remotely, here’s the extension I made, tell me what you think.

Another thing I really wanted was to use WebRTC on the local network, which is possible in Chrome, but not yet in Firefox.
I think Firefox is asking for a use case according to this topic.

So, Firefox team, please allow us to do this without needing internet. My use case is often that I need to be offline on a virtual machine and copy and paste with the host or file sharing doesn’t work, so in that case I have no choice other than activating the internet and then share over it via other means that I may not trust for confidential documents.

And I use peerJs as a dependency in order to stabilize a WebRTC connection, it would be very nice if Firefox itself handled this pairing process natively.