Use window.parent rather than window.top to access iframe's parent

This prevents a cross origin error if the page is embedded inside a
third party iframe.
This commit is contained in:
Kovid Goyal 2024-10-17 17:34:15 +05:30
parent 6ea96a83f7
commit a3f4c961a5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -127,7 +127,7 @@ def setup_iframe(iframe):
a.setAttribute('target', '_parent')
def forward_touch_events(ev):
container = window.top.document.getElementById(render_book.container_id)
container = window.parent.document.getElementById(render_book.container_id)
if container:
dup = v'new ev.constructor(ev.type, ev)'
container.dispatchEvent(dup)