By using window.print()
in JavaScript, it does show a print preview in Google Chrome, but not in Firefox. Is there any solution for this?
Asked
Active
Viewed 8,389 times
12

Ivar
- 6,138
- 12
- 49
- 61

user3464105
- 121
- 1
- 4
-
I tested this command, and it is showing default browser print dialogue in IE and FF, what do you see in firefox ? – Usman Waheed Mar 27 '14 at 07:34
-
1By giving that command, in FireFox it show normal print dialog box not an preview page. But in Google chrome it shows preview page by giving this same command. – user3464105 Mar 27 '14 at 07:39
-
thats default setting from browsers you cannot force a browser to show a dialogue on your will. Check this SO thread: http://stackoverflow.com/questions/230205/how-can-print-preview-be-called-from-javascript – Usman Waheed Mar 27 '14 at 07:41
-
ok thank you... then how to display printpreview page before print?? – user3464105 Mar 27 '14 at 07:44
-
I am trying to print a popup window page. How to display a print preview page in popup window.. – user3464105 Mar 27 '14 at 08:00
1 Answers
10
In Firefox, this is not possible. Your only option is calling window.print
, which only opens the Print dialog. Firefox extensions are able call PrintUtils.printPreview
, which opens the Print Preview window, but this API is not visible from the JavaScript code of webpages.
Source: Mozilla Support

kol
- 27,881
- 12
- 83
- 120