Tip. You cannot detect “user cancelled” from the return value.
Compatibility
Browser Support
Window.print() is marked Baseline Widely available on MDN (since June 2023). Browser Window API.
✓ Baseline · Widely available
print()
Open the print dialog across modern browsers.
99%Core tag support
ChromeYes
Full support
EdgeYes
Full support
FirefoxYes
Full support
SafariYes
Full support
OperaYes
Full support
HTML element100% supported
Bottom line: Safe to use for Print buttons. Pair with @media print for clean output.
Frequently Asked Questions
It opens the browser print dialog for the current document so the user can print or save as PDF. JavaScript cannot skip the dialog or force a silent print.
No. MDN marks Window.print() as Baseline Widely available (since June 2023). It is not Deprecated, Experimental, or Non-standard.
No. Call print() with no parameters. The return value is undefined.
Yes. MDN: the method blocks while the print dialog is open. Code after print() runs only after the dialog closes.
beforeprint fires when the document is about to be printed or previewed; afterprint fires when printing finishes or the dialog closes. Prefer @media print CSS when you only need layout changes.
Not with a parameter. Hide sections with @media print, or open a popup/iframe with only the content and call print() on that window.