JavaScript Window print() Method Last Updated : 04 Mar, 2024 Comments Improve Suggest changes Like Article Like Report The window.print() method in JavaScript is used to open the Print Dialog Box, which allows users to print the contents of the current window or document. Window print() Method Syntaxwindow.print();Window print() Method ParametersNo parameters are required Window print() Method Returns ValueThis function does not return anything Window print() Method ExampleThis example shows a print button and then it shows the property of that webpage in a sheet in which you are going to print it. HTML <!DOCTYPE html> <html lang="en"> <head> <title> JavaScript Window print() Method </title> </head> <body> <h2>HI GEEKSFORGEEKS USER'S</h2> <form> <input type="button" value="Print" onclick="window.print()" /> </form> </body> </html> Output: ExplanationIn this example we directly embedded in HTML using the button's onclick attribute.Clicking the button triggers window.print() method, invoking the browser's print functionality.window.print() opens print dialog for users to print current web page content.This method facilitates printing without needing a separate print button or functionality.JavaScript Window print() Method - UseCases:1. How to print the content of current window using JavaScript ?window.print() method is used to open the Print Dialog Box to print the current document. It does not have any parameter value. 2. Print the content of a div element using JavaScriptTo print a div's content in JavaScript, store div content in a variable, then on button click, extract and write div content to a popup window, and print using window.print(). Supported Browsers: Google ChromeEdge Internet Explorer Firefox OperaSafari Comment More infoAdvertise with us Next Article JavaScript Window print() Method M MrinalVerma Follow Improve Article Tags : Misc JavaScript Web Technologies javascript-functions Practice Tags : Misc Similar Reads How to print a web page using JavaScript ? Javascript is the world most popular lightweight, cross-platform, interpreted compiled programming language, along with a scripting language for web. It facilitates the dynamic functionality that helps to make the interactive website. As all the Morden browsers use the Javascript & is a client-s 2 min read How to print the content of current window using JavaScript ? The task is to print the content of the current window by using the window.print() method in the document. It is used to open the Print Dialog Box to print the current document. It does not have any parameter value. Syntax: window.print()Parameters: No parameters are requiredReturns: This function d 2 min read Print the content of a div element using JavaScript If you want to print the content of a <div> element using JavaScript, you can achieve this by extracting the content and then opening a new window or popup to display and print it. This method involves capturing the content of the <div>, creating a new window, and using the print command 2 min read ES6 Page Printing As we know, ECMAScript (ES) is a scripting language specification standardized by ECMAScript International. It adds new features to javascript. Its specification is influenced by languages like Self, Perl, Python, Java, etc. Some call it JavaScript 6. So, printing the page is the same. By using the 3 min read System.out.println in Java Java System.out.println() is used to print an argument that is passed to it. Parts of System.out.println()The statement can be broken into 3 parts which can be understood separately: System: It is a final class defined in the java.lang package.out: This is an instance of PrintStream type, which is a 5 min read Like