In an application I've made, there is a PDF Viewer. It's simply just an IFrame with a PDF Blob set as the src attribute.
Now I'm wondering if I can somehow access the scroll position of that IFrame?
I tried to access the contentWindow.scrollY
of the IFrame, the contentWindow.window.scrollY
and may more and am now running out of ideas.
With another IFrame that has a srcDoc attribute (HTML), accessing the contentWindow.scrollY
works fine in the same project.
Also, currently, I'm just working with chrome, I would appreciate if someone has an answer that works across different browsers.
UPDATE: When I open the application in Firefox I can actually see an error, when I try to scroll the PDF IFrame:
SecurityError: Permission denied to access property "scrollTo" on cross-origin object
I was already suspecting a security reason, I guess chrome just doesn't report that? Still, I'm wondering how I could solve this because the PDF is generated locally to a Blob URL, so it's not really a cross-origin object