W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: Re: [Clipboard] checking if implementation allows reading/writing a given type to the OS clipboard

From: Hallvord Reiar Michaelsen Steen <hallvord@opera.com>
Date: Sat, 18 Feb 2012 01:16:52 +0100
To: "Paul Libbrecht" <paul@hoplahup.net>
Cc: public-webapps@w3.org
Message-ID: <8ff450f3ee78476a89e6396d92fa3482@opera.com>

Having thought about this some more, I see that there is a fingerprinting concern if we tie this closely into the available applications/OS capabilities. Also I understand that the API would be relevant for drag and drop (thought I'm not quite sure how it would work). Hence I think the method should be on the DataTransfer.prototype object, and usable only inside event handlers:



if(event.clipboardData.isTypeSupported('foo/bar')) ...


"Supported" means: if you give me data labelled as this type, I know the OS description and (if applicable) the relevant meta data and formatting for this type, and can write it to the clipboard so that other native apps can make use of it. If data labelled with the OS's native name or constant for this type is on the clipboard, I can map it to the mime type and extract the data in a way the script can use. Additionally, if a blob of data in this format is dropped on my window, I'll know what to do about it, and if you drag this data *from* my window to another application on the system, I can format and label it in a way the targe app will understand."


Paul Libbrecht wrote:
  
> I have one concern: media-types are likely to be insufficient
> and "flavour names", whatever they are on the host platform
> should be allowed I think. Almost arbitrary strings on Windows
> and Uniform Type Identifiers on Mac should be allowed, I think.

No, I really don't think it is a good idea to make scripts on the web have to sniff the OS to determine what argument to pass to isTypeSupported().. If MIME types aren't sufficient, maybe we need to mint more MIME types as we go? :)

-- 
Hallvord R. M. Steen
Core tester, Opera Software
Received on Saturday, 18 February 2012 00:19:12 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT