Small JavaScript library to override print functions, disable printing and print preview on websites
NoPrint.js is a lightweight JavaScript library designed to provide an easy way for web developers to disable printing functionality on their websites. With just a few lines of code, NoPrint.js overrides the standard window.print() method and prevents users from being able to print pages.
This can be useful for web apps or pages containing sensitive information that should not be physically printed. For example, NoPrint.js could be implemented in web-based email services, financial dashboards, legal document portals, or other applications dealing with private user data.
Using NoPrint.js is very straightforward - simply include the script on any page you wish to block printing on, then call NoPrint.disable(). Optionally, you can whitelist specific parts of the page that should still allow printing. The script automatically hooks into all major printing methods including keyboard shortcuts, browser menus, and JavaScript calls.
NoPrint.js has no dependencies, keeping downloads small and integrations simple. It works across all major desktop and mobile browsers. The code is open source on GitHub allowing customizations if required. Overall, NoPrint.js is the easiest way for web developers to quickly add print protection on a webpage.
Here are some alternatives to NoPrint.js:
Suggest an alternative ❐