HackingUniversity - Hacks . Tricks . How-To's

03 May 2016

Disable Right Click, Ctrl + Commands on Blogger Website

Earlier I posted on how you can disable Image Dragging option on your blogger blog or any other website well that could be useful in case you wanted to stop any stranger from copying your images and reposting them on their own blog. We have even covered some nice tutorials on disabling text dragging on your website for stopping content thief's, which could be done by a code or using CSS.

protect your content from getting copied

Today we have another awesome script that will help you in disabling Right Click, Image Dragging and Disabling all those Ctrl + commands like Ctrl + A for selecting all content, Ctrl + C for copying selected content and many other commands.

Protect your Content on Blogger, Wordpress or Other Sites with this Simple Script

Now this simple script combines all the things, so you need to just paste this one script in your <head> and everything will be done by it automatically. So lets see how you can implement this script in blogger, wordpress or any other website.

  1. Open Blogger > Template > Edit HTML.
  2. Press Ctrl + F and search for </head> tag and paste below script right above this tag.

    <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'/>

    <script type='text/javascript'>document.onkeypress=function(event){event=(event || window.event);if (event.keyCode===123){return false;}};document.onmousedown=function(event){event=(event || window.event);if (event.keyCode===123){return false;}};document.onkeydown=function(event){event=(event || window.event);if (event.keyCode===123){return false;}};function cp(){return false;}function mousehandler(e){var myevent=(isNS) ? e : event;var eventbutton=(isNS) ? myevent.which : myevent.button;if ((eventbutton==2) || (eventbutton==3))return false;}document.oncontextmenu=cp;document.onmouseup=cp;var isCtrl=false;window.onkeyup=function(e){if (e.which==17)isCtrl=false;}window.onkeydown=function(e){if (e.which==17)isCtrl=true;if (((e.which==85) || (e.which==65) || (e.which==88) || (e.which==67) || (e.which==86) || (e.which==83)) &amp;&amp; isCtrl==true){return false;}}document.ondragstart=cp;</script>

  3. If you are already using the jQuery code in your site then you can remove that RED LINE provided above from the code.
  4. Now save your template and your code is up and running, try refreshing your blog and see if you can able to Right Click, Drag Images, and even use the Ctrl + Commands.
  5. You won’t be able to use any commands. That's what this script is blocking you to do.
  6. Implementing this script in Wordpress and other sites is same, so you need to paste the script above your </head> tag and everything will be done automatically.

This ends this another awesome post that will help you in protecting your content from getting copied. Have fun and in case you face any sort of errors do comment below for me to check and rectify the script.