Dear All, This is great, thank you James and Nicholas! I've folowed your suggestions and now have a WebExtension that works very well to overwrite window.print().
There is also the case that a website wants to download a PDF file for printing. In this case I need to catch that file, and upload it to my server for printing. It seems GeckoView would delegate downloads normally to the Android System so it can save the file on the phone, but here I would like to access the file in the App and send it back to a server for printing. Is it possible to handle the downloads in the app and get access to the downloadable file for upload? Does GeckoView provide some kind of Listener for downloads? Warm regards, Urs On 2/27/20 9:20 PM, James Willcox wrote: > > > On Thu, Feb 27, 2020 at 2:01 PM Urs Riggenbach > <urs.riggenbach.ph...@gmail.com > <mailto:urs.riggenbach.ph...@gmail.com>> wrote: > > > > I would like to run Android app code when window.print() is run. > Is this best done in a WebExtension? Or is there a simple way to > overwrite such functions? > > Yeah, a Web Extension is best for this, but it's a little complicated. > You'll need to use this mechanism[1] to communicate with the page from > a content script, and then some hacks[2] for injecting code into the > actual page. > > James > > > [1] > https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#Communicating_with_the_web_page > [2] > https://stackoverflow.com/questions/12395722/can-the-window-object-be-modified-from-a-chrome-extension
_______________________________________________ mobile-firefox-dev mailing list mobile-firefox-dev@mozilla.org https://mail.mozilla.org/listinfo/mobile-firefox-dev