-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hypothesis expects Host in parent frame, not in any ancestor or top frame #6474
Comments
Hello, sorry for the delay in responding.
Is there a reason that the
Indeed, we have important use cases where the host frame is not the top frame.
You are not missing anything. We introduced the constraint that guests have to be direct children of hosts a while back as a simplification for the use cases we cared about at the time. The simplest structure here would be if the A possible structure for the configuration would be something like:
Where |
Hi @robertknight , thanks for getting back at me!
The reason primarily being that the child frame content is from a CDN serving Pdf2HtmlEx output (for which I am developing an extension in our fork athenagroup#1). So without the frame in between I would need to proxy the requests and inject the script through that means. (I only found out about viahtml after already cooking up the necessary changes 😅 ). I cannot serve the viewer from the host level domain as I do not control the host (in this case an LMS).
I'll have a look if we can implement this solution in a PR. |
As hosts cannot inject the Hypothesis Client into a cross origin frame, we experimented loading the Hypothesis client into the frame through an intermediary subframe. This leads to the following structure:
The intermediate frame has
subFrameIdentifier
set. This way we do not load the sidebar, notebook and profile in this frame. Injection to the child frames works fine.However, the child frame posts its messages directly to the parent window, while most of Hypothesis client runs in the top frame. As a quick fix we temporarily set the
hostFrame
towindow.top
and that seemed to do the trick:However, it appears to be incorrect to assume the Hypothesis Client will always be loaded in the top frame. From the documentation it appears that for example the VitalSourceInjector assumes a setup where the Book container frame (not the top frame) appears to be the host:
Not sure though if I am interpreting this part of the documentation correctly.
However, perhaps we can find the correct Hypothesis frame using an
ancestorLevel
configuration property, analog to the same property forrequestConfigFromFrame
.ancestorLevel
approach seem sensible?The text was updated successfully, but these errors were encountered: