jQuery Script to Disable Right Click And Control Save on your Site

This following jQuery script help you to prevent your html page from saving as well prevent the access of html source code.   jQuery script to disable right click option of browser on your html page or site. $(document).bind(‘contextmenu’,function(e){ e.preventDefault();…

3
jQuery script to disable right click and control save on your site

This following jQuery script help you to prevent your html page from saving as well prevent the access of html source code.

 

jQuery Script to disable right click and control save
Demo
jQuery script to disable right click and control save on your site
jQuery script to disable right click and control save on your site

jQuery script to disable right click option of browser on your html page or site.

$(document).bind('contextmenu',function(e){
       e.preventDefault();
});

or

$(document).bind('contextmenu',function(e){
       return false;
});

jQuery script to disable control + save( Ctrl+ s) option of windows OS on your html page or site.

$(window).unbind('keypress').keypress(function(event) {
   if (!(event.which == 115 && event.ctrlKey))return true;
              event.preventDefault();
	      return false;
});

 

If your non-programmer please follow this steps to add this script to your site.

Steps:

1. Find the following </body> tag in your html source code.
2. Now copy the below script and paste before closing </body> tag.

<script src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
<script>
(function ($) {
          $(document).bind('contextmenu',function(e){
	       e.preventDefault();
	  });
	  $(window).unbind('keypress').keypress(function(event) {
		if (!(event.which == 115 && event.ctrlKey))return true;
			    event.preventDefault();
			    return false;
		});

}(jQuery));
</script>

 .

3 responses to “jQuery Script to Disable Right Click And Control Save on your Site”

  1. hi,

    found your blog from indiblogger,
    was wondering if you know a JS to copy the website/article URL if someone copies anything from the website. i.e if someone copies anything from your website your URL should get copied along with it.
    hope you get what i mean.

    thanks
    support|at|letsbytecode.com

  2. muni

    hi,

    Yes, I had script for your requirement. Do you need it ?

    Regards,

    Muni

  3. Your demo page, prevents to copy images, but not texts. I want to prevente text copies, it’s possible ?

Leave a Reply