Skip to content

Clipboard API #143

@AshleyScirra

Description

@AshleyScirra

Description

Modern clipboard APIs have been around for a while, so we don't need to rely on things like document.execCommand('copy') any more. However support is still patchy and inconsistent across browsers, meaning fallbacks are still sometimes required.

Rationale

Using the clipboard is a very common task for web developers - e.g. this StackOverflow question "How do I copy to the clipboard in JavaScript?" has over 4000 votes.

However reading from the clipboard is still not supported in Firefox (readText() is only supported in extensions, not web content). Browsers have different rules about when access is allowed (see #142). Support for binary formats and certain MIME types appears to be mixed (e.g. is HTML allowed? AVIF images? SVG? is metadata preserved? etc), and there's newer support for "Web Custom Formats". Overall it's all a mixed bag. It would be good if this was a robustly interoperable part of the web platform.

Specification

https://www.w3.org/TR/clipboard-apis/

Tests

https://wpt.fyi/results/clipboard-apis

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions