FrontendDeveloper.in

JavaScript question detail

How do you print the contents of web page

The window object provides a print() method which is used to print the contents of the current window. It opens a Print dialog box which lets you choose between various printing options. Let's see the usage of print method in an example,

<input type="button" value="Print" onclick="window.print()" />

Note: In most browsers, it will block while the print dialog is open.

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399