NoPrint.js: Disable Print, Screenshot, Copy & Paste in HTML by JavaScript
NoPrint.js is a small and neat open source JS library that disables print, screenshot, copy and paste functions in HTML. You can also enable the AutoBlur option to let the content turn to blur once the mouse leaves the webpage. That will prevent most of common users from taking screenshots. NoPrint.js can work on most of popular web browsers such as Chrome, Edge, FireFox and Opera.What NoPrint.js Can Do
Disable Copy and Paste
Disable Print
Disable Mouse Right Button
Disable Screenshot
Disable "Save As" / Ctrl + S
AutoBlur
You can open this example page to view the NoPrint.js running results.
How to Use NoPrint.js
You can copy this code below and insert into your HTML before </body>:
<script language="javascript">
var noPrint=true;
var noCopy=true;
var noScreenshot=true;
var autoBlur=true;
</script>
<script type="text/javascript" src="https://pdfanticopy.com/noprint.js"></script>
If you want to call NoPrint.js from your server directly, you can Download NoPrint.js (3KB) here (click by mouse right button and save), and change the last row of the above code to:
<script type="text/javascript" src="noprint.js"></script>
Variables of NoPrint.js
var noPrint=true;
noPrint will disable CTRL + P shortcut key and the print function. Even the visitor try to print the web page by the browser menu or button, the content would change to a blank page in printing. You can set noPrint to false to turn the printing protection off.
var noCopy=true;
noCopy will disable text selection, the mouse right button, CTRL + S (Save web page) and the copy and paste functions. You can set noCopy to false to turn this protection off.
var noScreenshot=true;
noScreenshot will disable the PrintScreen key to prevent visitors from taking a snapshot of the web page easily. You can set noScreenshot to false to turn this off.
var autoBlur=true;
autoBlur will turn all content on your web page to blur once the mouse cursor leaves the content area. The content could be changed back by a click on the web page. This can prevent people from taking screenshot by 3-rd party applications or the Snapshot function on Opera toolbar. You can set autoBlur to false to disable the autoBlur.