Unlike just about every other major browser, in Firefox, window.print
opens the print dialog instead of the print preview dialog. This issue was recognized by Firefox devs a long time ago, and, rather than "fix" it, they decided to implement a different, Firefox-only function browser.tabs.printPreview
that opens the print preview dialog for the current active tab.
I am printing a hidden iframe, and ideally want to display the print preview dialog, not the print dialog. It's easy enough for me to feature detect browser.tabs.printPreview
, however, I haven't been able to find a way to make it act on an iframe instead of the current tab.
Is there a way to open the print preview dialog for an iframe in Firefox, either using browser.tabs.printPreview
or some other method?
Clarification: this is for a React library that I maintain, react-to-print
, that wraps a user's JSX with our component. Except for what is wrapped by the component (the content the user wants to print) I do not have any control over content on the page.