client icon indicating copy to clipboard operation
client copied to clipboard

Permissions policy violation: unload is not allowed in this document.

Open StructSeeker opened this issue 9 months ago • 2 comments

I have this problem when reading epub and switching chapters on chrome. It seems to be the result of deprecating-unload. The hypothes.is client give the following uri

http://127.0.0.1:3000/dist/index.html, https://s3.amazonaws.com/moby-dick/OPS/chapter_033.xhtml, https://s3.amazonaws.com/moby-dick/OPS/chapter_033.xhtml, https://s3.amazonaws.com/moby-dick/OPS/chapter_033.xhtml, https://s3.amazonaws.com/moby-dick/OPS/chapter_006.xhtml, https://s3.amazonaws.com/moby-dick/OPS/chapter_007.xhtml, https://s3.amazonaws.com/moby-dick/OPS/chapter_008.xhtml

StructSeeker avatar Mar 31 '25 18:03 StructSeeker

The integration with Epub.js and Readium is non-functional and needs to be re-implemented from scratch along the lines of the VitalSource integration. See also https://github.com/hypothesis/client/issues/4283 and https://github.com/hypothesis/client/issues/4153. We have removed references to Epub.js and Readium from the Hypothesis website.

robertknight avatar Apr 10 '25 09:04 robertknight

We currently use the unload event to:

  1. Detect when a guest window is unloaded and send a "close" message via the MessagePort. See https://github.com/hypothesis/client/blob/30112b6268f88c44556b53d7494ae3e7b0981e23/src/shared/messaging/port-rpc.ts#L245
  2. Detect when a same-origin iframe is about to navigate to a different document. See https://github.com/hypothesis/client/blob/30112b6268f88c44556b53d7494ae3e7b0981e23/src/annotator/frame-observer.ts#L69.

Point (1) is a pain because the platform does not have an alternative API for detecting when the other end of a MessagePoint goes away. There was work being done on an onclose handler, but that has gotten stalled for security reasons. This thread has some workarounds for same-origin iframes which might be enough for our needs.

robertknight avatar May 28 '25 09:05 robertknight