This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21699 - [spec.next] figure out how to make clipboard data type support discoverable
Summary: [spec.next] figure out how to make clipboard data type support discoverable
Status: NEW
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Clipboard API and events (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Hallvord R. M. Steen
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-15 08:32 UTC by Hallvord R. M. Steen
Modified: 2015-06-05 14:45 UTC (History)
3 users (show)

See Also:


Attachments

Description Hallvord R. M. Steen 2013-04-15 08:32:54 UTC
JS should be able to query if a given MIME type can be written to clipboard.

This querying should not depend on events firing/direct access to a event.clipboardData property.
Comment 1 James M. Greene 2013-10-17 04:44:24 UTC
Prior Art:
In Flash, you could query which formats were available via a read-only array called `formats` on the clipboard object (equivalent of `clipboardData`):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html#formats

However, you already said that we should avoid putting it on `clipboardData`, to which I would agree.

The one caveat to keep in mind is that, even if some MIME type is not reported as being support by the clipboard object, it should still be possible to write that unsupported type to the clipboard in its own segment. This allows for consumption of custom data by other applications -- both web-based and not, e.g. copying a quote into the Skype clipboard style:
    https://code.google.com/p/skype-quote-generator/
Comment 2 Hallvord R. M. Steen 2014-01-21 00:14:18 UTC
Would it be weird to define window.ClipboardEvent.formats ? It would be an array listing the MIME types the implementation knows how to write to and read from the clipboard, for example:

window.ClipboardEvent.formats = ['text/plain', 'text/html', 'image/jpeg']

Though this raises fingerprinting concerns. Actually, maybe this should be pushed to HTML and defined as part of the DataTransfer stuff: http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#the-datatransfer-interface - implies it will only be available during event handling, but for general web usage that may be the best we can get..
Comment 3 James M. Greene 2014-01-23 23:20:07 UTC
I would agree that it could be valuable to have it available for the DND interfaces, too. My concern would be strictly from the API side, though: it may become quickly confusing to have both a `types` (http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-types) and `formats` property on the object.
Comment 4 Ben Peters 2014-11-06 00:14:46 UTC
I don't think this should block V1
Comment 5 Hallvord R. M. Steen 2015-06-05 14:45:31 UTC
See also related discussion here: https://github.com/w3c/clipboard-apis/issues/9