HackingUniversity - Hacks . Tricks . How-To's

15 May 2012

How to Disable Right Click Context Menu On Images

Blogger-logoImages usually bring more interactivity to your posts and articles, they can increase point of view for a visitor, but its easy to be stolen anyone can right click and choose save image as option and store that image on his pc fro further posting or sharing. But sometimes your images are privately owned or copyrighted well now you can disable right click context menu on your images using a very easy script created by GreenLava @ BloggerSentral. Well using this easy script you can add any text message which will be visible to all the readers who right click on your images.

context-menu-disabledSo now you can disable right click on al the images present on your blog or on a specific image which might need that for some security reasons.

#1. Disabling Right Click on all Images ::

Now with the below script added you can easily make all the images right click disabled, so any old image will also show the same message as the new image is added.

  1. Go to Blogger.com and Sign in to your account, choose your blog and navigate to Template > Edit HTML Section.
  2. Now press Ctrl + F to open the search dialog and search for </head> tag and paste the below script right above it.
  3. Now after pasting this just Save your Template and refresh your blog to see if this is working. You can also modify the message in the red color according to your needs.

#2. Disabling Right Click on Specific Image ::

Now the above works like a charm and will disable the right click on all the images present on your blog. But sometimes you do not need this on all images but on a specific single image than we have a solution for that too just check below.

So you just need to add below code in the img tag and right click context menu will be disabled.

oncontextmenu='alert("Image context menu is disabled");return false;'

So now your normal img tag looks somewhat like below :

<img border="0" src="http://lh3.ggpht.com/-hFLv1pMH67s/T7HbM_Zy-3I/AAAAAAAADt8/6YTHSZg4VhY/knowledge%25255B8%25255D.jpg" />

And you can have to modify it adding the above context menu disabling code which will make your img tag like below.

<img oncontextmenu='alert("Image context menu is disabled");return false;' border="0" src="http://lh3.ggpht.com/-hFLv1pMH67s/T7HbM_Zy-3I/AAAAAAAADt8/6YTHSZg4VhY/knowledge%25255B8%25255D.jpg" />

So now this will disable right click on specific image you wanted too, hope this tutorial works for you get success in saving your images from right click frauds.

via - BloggerSentral