Skip to content

Commit

Permalink
Document how to set clipboard-write permission
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Jan 30, 2024
1 parent a185d1e commit dab5b92
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/publishers/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,29 @@ document and have the same origin.

The client will watch for new iframes being added to the document and will
automatically enable annotation for them.


Clipboard permissions when loaded in an iframe
----------------------------------------------

There is a few places in the sidebar where the user can copy content to the
clipboard:

* The link, when sharing an annotation.
* The sidebar's version.
* The content, when exporting annotations to any format.
* Etc.

This is done through the browser's
`Clipboard API <https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API>`_,
which requires allowing the ``clipboard-write`` permission.

When loading the sidebar in the top-level document, this should work out of
the box, but if you load Hypothesis inside an iframe, remember adding the
allow attribute with the right permissions.

.. code-block:: html

<iframe allow="clipboard-write">
<!-- Hypothesis is loaded here -->
</iframe>

0 comments on commit dab5b92

Please sign in to comment.