Content scripts on PDF pages when chrome://flags/#pdf-oopif is enabled
136 views
Skip to first unread message
Andreas Gruber
unread,
Sep 3, 2024, 12:28:01 PMSep 3
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium Extensions
We are injecting a content script into PDF pages like https://arxiv.org/pdf/1801.00006. The content script then shows a div element. When chrome://flags/#pdf-oopif is enabled this does not work anymore.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium Extensions, Andreas Gruber
If you use devtools you should see that the content script is actually injected (devtools -> Sources -> Content scripts), but your code fails because the document is different now.
Don't append your UI to document.body, use document.documentElement and z-index:2 or higher.
To access the pdf's iframe element use chrome.dom.openOrClosedShadowRoot(document.body).querySelector('iframe')