client icon indicating copy to clipboard operation
client copied to clipboard

Whenever an iframe changes location Hypothesis needs to be injected again

Open jwgmeligmeyling opened this issue 1 year ago • 2 comments

When enabling annotations on an iframe with the enable-annotation attribute, it appears the client is only injected once. This leads to issues when the frame navigates to another page. I haven't checked whether the issue exists for all types of navigation (for example if it matters if the parent or the frame itself is causing the navigation). In this particular case the frame was initialised with about:blank.

jwgmeligmeyling avatar Jul 27 '24 19:07 jwgmeligmeyling

In this particular case the frame was initialised with about:blank.

We have code that is supposed to handle this use case and avoid the overhead of redundantly loading the client into an about:blank frame. See hasBlankDocumentThatWillNavigate. Can that solve your use case with some extensions?

robertknight avatar Aug 02 '24 11:08 robertknight

I presume the hasBlankDocumentThatWillNavigate in this case wasn't sufficient because the <iframe> had no src set but instead got it assigned through either element.setAttribute or contentWindow.location. Any ideas how to solve this differently than registering a load event handler?

jwgmeligmeyling avatar Aug 02 '24 13:08 jwgmeligmeyling