Disable Right Click and F12 Developer Tools Option

If you want to disable right-click on your website and keyboard-f-12 browser developer tools option, You can add the following code on your site.

You can use this script in any script file.

//Disable right click
$(document).on("contextmenu", function (e) {        
    e.preventDefault();
});

//Disable F12
$(document).keydown(function (event) {
    if (event.keyCode == 123) { // Prevent F12
        return false;
    } else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { // Prevent Ctrl+Shift+I        
        return false;
    }
});

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *