xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.

Opened 3 years ago

Last modified 4 months ago

#1844 closed enhancement

async clipboard api — at Version 4

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: critical Milestone: 3.0
Component: html5 Version: 2.3.x
Keywords: Cc:

Description (last modified by Antoine Martin)

See Unblocking Clipboard Access: It's a replacement for execCommand-based copy & paste that has a well-defined permissions model and doesn't block the page.

MDN: Navigator clipboard.

Original html5 clipboard tickets: #842, #1461

Change History (4)

comment:1 Changed 2 years ago by Antoine Martin

See also related work in #812

comment:2 Changed 2 years ago by Antoine Martin

Status: newassigned

For images, see #2312

comment:3 Changed 2 years ago by Antoine Martin

Priority: majorcritical

Blocker for #2312

comment:4 Changed 2 years ago by Antoine Martin

Description: modified (diff)


  • r22834 new async api calls
  • r22837 answer clipboard requests
  • r22838 workaround PRIMARY + CLIPBOARD overwriting values
  • r22839 don't bother synchronizing PRIMARY if we have the new async API
  • r22840 stricter test for navigator.clipboard API availability

Important: just found information on clipboardchange event in w3c: Async Clipboard API. This is not supported in any browser yet.
This means we would not necessarily have to claim the clipboard every time we get a token, we could rely on those events to notify the server.
For chrome: onClipboardDataChanged.

Maybe we should query the Permissions API rather than just checking if the method exists?
See Asynchronous Clipboard API Sample


  • Chrome 75.0.3770.51 (Official Build) beta (64-bit) Linux: OK (connecting to localhost using websocket)
  • Chrome 74 MS Windows: OK via https, otherwise legacy mode
  • Firefox 67 Linux: legacy mode
  • Firefox 67 MS Windows: legacy mode

The Firefox results are surprising since they claim to support the async API since V63, but this matches the results from this test.
The spec says: Firefox only supports reading the clipboard in browser extensions, using the "clipboardRead" extension permission.

Then there are also issues with "secure contexts": works for localhost, otherwise https is required, etc..

Last edited 2 years ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.