I created a browser extension that lets you look up words in Wikipedia or Wiktionary without needing to open a new tab ( https://addons.mozilla.org/en-US/firefox/addon/in-page-lookup/ , almost done porting to Chrome). It is very useful when you are doing research and come across a word you don't know or want to know more about. The only thing is, a lot of research content is in PDF format. A long time ago (~2013ish) I had an older version of the app based on the old Firefox add-on framework and that did let iframes show up over pdf documents but this has not been the case for many years. I don't think the extension is even recognized in pdf documents, I get "Error: Could not establish connection. Receiving end does not exist" and there is no extension content script on the pdf page. So, my question is, is it possible to put an iframe over a pdf document? Do I need to work on the background side, and if so, how? Thanks.
Asked
Active
Viewed 84 times
0
-
Extensions can certainly add stuff (and iframes) to the built-in PDF viewer in Chrome using the standard content script mechanisms, however they can't do it if a third-party PDF viewer extension is used. – wOxxOm May 14 '20 at 07:54
-
I see it is possible in Chrome to _sometimes_ use keys to open an iframe after you have opened it using a right mouse button menu option. If the focus goes back to the pdf, the key combos stop working. The problem is the iframe is outside the embedded pdf so it cannot get the selected text. Is there a way to capture highlighted pdf text? I think I can get the iframe to always open, but I am not sure how to capture the selected text (currently using `window.getSelection()`). In Firefox, it doesn't use – SomeoneElse May 14 '20 at 18:51
-
1[How can I get selected text in pdf in Javascript?](https://stackoverflow.com/a/61076939) – wOxxOm May 14 '20 at 19:35