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

Any MIME type support restrictions that apply to clipboard MIME types will
almost certainly apply to DnD MIME types as well. Therefore, it wouldn't
make sense to tie it to ClipboardEvent.

Also, what does it mean to be "supported"? In new versions of Chrome, any
kind of MIME type is supported in the sense that you can set data for any
arbitrary type, and it can be understood by any browser that uses the same
native conventions (I'd be happy to work with any other developers
interested in making sure this works across different browsers on the same
computer).

Daniel

On Fri, Feb 17, 2012 at 10:10, Paul Libbrecht <paul@hoplahup.net> wrote:

> Hello Hallvord,
>
> I think it is a very good idea if such a method would be available from
> the point of view of a web-app author.
>
> 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.
>
>
> Le 17 févr. 2012 à 18:53, Ryosuke Niwa a écrit :
>
> I like the idea of letting authors dynamically detectthe supported mime
> types. But providing methods on the interface object seems rather unusual.
>
>
> It sounds like ok to me. An alternative would be to have a Capabilities
> object...
>
> Also, I'm thinking if there are cases where the supported mime types
> change dynamically without reloading the page.
>
> (I hope I patched correctly)
>
> Yes, it does happen: I think I know that in Windows the supported
> flavour-names depend on the launched applications. On Mac it depends on the
> applications whose descriptor has been loaded (by the Finder I think, it
> might also be those that have been launched once).
> At least an application download and launch can cause a change in the
> supported media-types of the OS.
>
> However, would the browsers be informed of such a change?
> Would they be able to consider a given type as being safe and not needing
> a sanitization?
>
> paul
>
>
>
>
>
> Le 17 févr. 2012 à 14:23, Hallvord R. M. Steen a écrit :
>
> Hi,
> I have an open issue noted in the spec - seems no implementor has worked
> on this yet so I'm throwing it out here to see what you all think.
>
> Given that
> a) We can't give a random script access to every format on the clipboard
> for security/privacy reasons (per earlier feedback from Chrome/WebKit devs
> and common sense)
> b) Certain clipboard formats have meta data or special formatting
> requirements that mean the implementation needs to do a bit of processing
> on reading/writing (thinking of Windows' CF_HTML)
> c) Text may apparently be placed on the clipboard in different encodings,
> an implementation may have to do conversions
> d) Clipboard contents can also be file references, in which case we'll
> make the *file* and not the actual clipboard data available
>
> - it's obvious that the implementation needs to do a bit of work to
> "support" reading/writing given types of data from/to the native clipboard.
>
> Hence, there should be a way a script can check if a clipboard format is
> registered and whether the implementation allows writing this format to the
> clipboard.
>
> My idea (at the moment) is to define a method on an interface (not on
> instances, on the interface object itself) like this:
>
> ClipboardEvent.isTypeSupported('mime/type')
>
> or, perhaps:
>
> DataTransfer.isTypeSupported('mime/type')??
>
> (but it's more clipboard-specific and maybe it's confusing to mix it with
> the DnD stuff?)
>
> An application can then for example do something like
>
> if( ClipboardEvent.isTypeSupported( 'vnd.supersoft/fancyformat' ) ){
>  // prepare fancyformat content and place on clipboard
> }else{
> // fall back to for example put xml-data-as-plain-text or
> json-data-as-plain-text
> }
>
> I'm suggesting to define this method on the interface object because it
> helps web applications do feature detection early.  It could of course be
> defined on instances
>
> addEventListener('copy', function(e){
>  if( e.isTypeSupported( 'vnd.supersoft/fancyformat' ) ){
>  // prepare fancyformat content and place on clipboard
>  }else{
>  // fall back to for example put xml-data-as-plain-text or
> json-data-as-plain-text
>  }
> })
>
> but then a feature/compatibility test would have to be deferred until a
> point where the user potentially has done a lot of work in the web
> application.
>
> Thoughts?
>
> --
> Hallvord R. M. Steen
> Core tester, Opera Software
>
>
>

Received on Friday, 17 February 2012 18:23:59 UTC