Skip to main content
InterviewHubPRO
Section Overview
Q217

Question 217 of 536

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

40%
JavaScript & V8 Internals (536 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

How do you print the contents of web page

mid LevelMost AskedCode ExampleEvent LoopPrototypes

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,

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

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