Hi public-webapps We are exploring a new web API for content to be notified of clipboard changes and would like to discuss it here.
The problem For certain classes of web apps, it is necessary to determine when new clipboard contents have been set, e.g. in order to fetch and display them, to update context menus, or synchronize the content with another application or device. The problem is that the web standard currently provides no explicit notifications when new content is copied from another application to the clipboard. As a result, these web apps typically re-fetch the clipboard every time they regain focus, and only act on the contents if they have changed since last time (e.g. passing it to a remote system, updating context menu, etc). This polling mechanism is generally inefficient, especially when the clipboard contains a large image file. We currently have interest from Citrix and Chrome Remote Experience teams in improving Chrome's clipboard support. The proposal Google propose to update the W3C Clipboard API and events specification <http://www.w3.org/TR/clipboard-apis/> with an onClipboardChanged event on the document object. The user agent should only signal the event if 1. a frame re-gains focus AND 2. the clipboard has changed since it last had focus. In addition, the user agent should not signal clipboard change events while a frame has focus. This will relieve the web app from the burden of filtering out notifications in response to clipboard changes generated by the app itself. We think this new API will avoid fetching large clipboard content repeatedly and unnecessarily for clipboard changes. Does the community think this API would be useful? We can go into more details and work on a detailed design together if the community is interested. Kelvin