Posts Learn Components Snippets Categories Tags Tools About
/

How to toggle Print Preview for Browsers

Learn how to toggle the print preview modal for all browsers using JavaScript

Created on Jan 02, 2022

233 views

To toggle the print preview on all browsers you can make use of the "print()" method available to the "window" global object.

Toggle Print Preview using JavaScript

window.print()
You can bind this to a button onclick method and right away after the button is pressed, the print preview of each respective browser will be shown to the user.

Print Preview on Firefox

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to toggle Print Preview for Browsers

)