javascript

how to disable right click in PDF file in browser

Posted on

How to disable right click in PDF file in browser 1. Using PDF CDN Copy-paste the script <script> into your <head><script src=”https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.3.200/pdf.js”></script> 2. Using jQuery CDN Copy-paste the script <script> into your <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js”></script> 3. Convert PDF file to Canvas, Disable F12 and right Click on the window <script> window.onload = function() {     document.addEventListener(“contextmenu”, function(e){         e.preventDefault();         if(event.keyCode == 123) {         disableEvent(e);     }     }, false); […]