Skip to content

Commit

Permalink
Update Minimal Implementation section
Browse files Browse the repository at this point in the history
Update after more context from a Webkit perspective on a minimal implementation. Source: #3 (comment)
  • Loading branch information
dway123 authored Oct 8, 2019
1 parent ef2f2b9 commit 62fa5f7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ This was decided against to simplify and minimize the API surface, by avoiding c
After some discussion with Webkit, a proposed alternative was to allow only "partner" sites, for example native and web applications with the same source origin, to have raw clipboard access. This was decided against for this explainer as it would break the compatibility requirements for Raw Clipboard Access, but may be a viable reduced implementation for user agents concerned about the full described API that may satisfy some common use-cases.

### Minimal implementation for user agents
A user agent that decides not to implement all of Raw Clipboard Access for various reasons should consider at least rejecting immediately on any call with `{raw : true}`. This allows web applications to gracefully detect failure, as they should already do in case of rejected permission or failure to encode/decode, and fall back to existing sanitized clipboard APIs. Rejecting immediately is important because otherwise web applications may do user agent detection, using the raw clipboard access for user agents that implement it, and using a fallback API for user agents that don’t. This means that if the user agent were to later implement such a feature, they would either need to either ask the web application to remove/update user agent detection, have to live with the feature not working on sites that implemented user agent detection, or (even worse) have to masquerade as a browser that previously implemented such a feature.

Feature detection should be possible by checking `ClipboardItem`'s prototype for the `raw` property, and may be helpful to detect whether to use Raw Clipboard Access is implemented, in environments where not all user agents have implemented. That said, Webkit has [suggested](https://github.com/dway123/raw-clipboard-access/issues/3#issuecomment-538627436) that a user agent that decides not to implement all of Raw Clipboard Access may also consider rejecting on any call with `{raw : true}`, and instead fall back and write the payload as `{raw : false}`.

## Permissions

Expand Down

0 comments on commit 62fa5f7

Please sign in to comment.