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


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

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


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours