W3cubDocs

/Web APIs

Window: print() method

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

js

print()

Parameters

None.

Return value

None (undefined).

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
1Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
12 1 5
6Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
1.1
4.4Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
18Starting with Chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
114
10.1Starting with Opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.
1
1.0Starting with Samsung Internet 5.0, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.

See also

© 2005–2023 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