window.print()
Opens the print dialog to print the current document.
If the document is still loading when this function is called, then the document will finish loading before opening the print dialog.
This method will block while the print dialog is open.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1.1 | 18 | 1 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
- Starting with Chrome 46, this method is blocked inside an `<iframe>` unless its sandbox attribute has the value `allow-modals`.
Notes 1 item(s)
Implementation note
- Starting with Chrome Android 46, this method is blocked inside an `<iframe>` unless its sandbox attribute has the value `allow-modals`.
Syntax
JAVASCRIPT
print() Use cases
-
Using window.print()
Opens the print dialog to print the current document.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.