dom / latest / window / print.html /

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.

Syntax

print()

Specifications

Specification
HTML Standard
# printing

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
print
1
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
12
1
5
6
Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
1.1
1
Starting with WebView 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
18
Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
No
10.1
Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
1
1.0
Starting with Samsung Internet 5.0, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/print