Clipboard promises demo

  1. Open two windows or tabs of this page.
  2. Copy in one of them. This queues up a clipboard promise.
  3. Paste in the other one. The data is produced by the copy-from tab and delivered.
Edit and select this text and copy it.
Paste in another tab.

Pasted stuff shows up here:



  
Simulating slow generation of data...
Pasting...

⚠ Clipboard promise technique disabled because of the following reasons:

This demo will fall back to classic synchronous clipboard access.

How does this work?

There are three things in play:

Now, when the user invokes "copy", the following happens:

The Shared Worker is essentially used as a connective tissue; glue that holds the many web page instances together.

Later, when the user invokes "paste", this goes down:

When copy and pasting locally, we would simply short-circuit the lookup and never even talk with the shared worker.

Source code →