Category: Vanilla Javascript

Added: 19th of March 2024

Viewed: 363 times


Display Print Dialogue window using Javascript

To display the Print Dialogue window in your web browser using Javascript, use the window.print() function. Below are two examples, one using a standard link and another using a button.

Regular HTML link

<a href="javascript:window.print()">Print This Page</a>


Input Type Button
<input type="button" value="Print This Page" onClick="window.print()">


Results

Print This Page