Remove the right-click context menu of images





sajib shahik | 7:54 AM | 0 Comments




Disable right click or shortcut menu is one of the most popular ways to prevent images from being stolen blog.

Although it is effective to some extent prevent the casual image theft, it frustrates honest readers denying them access to many useful functions associated with the right click as Going back, reload page, Bookmark and Open this link in a new window.

A better way would be to remove the right-click at the pictures. After all, the image they are trying to protect, and so this method is suitable to the task, and, above all, it is much less annoying for readers :). (It is impossible to keep people from stealing your images posted to your blog or website, but hey, it's better than nothing right?).

A. Disable right-click on all the images

Go to Edit HTML template and paste the following script immediately </ head> tag.
view source print?

01
<script type="text/javascript">
02
/ / <! [CDATA [
03
/ * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
04
Remove the context menu of images Green Lava (BloggerSentral.com)
05
Version 1.0
06
Feel free to copy and distribute this code, but do not remove this credit report.
07
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ * /
08
nocontext function (e) {
09
clickedTag var = (e == null)? event.srcElement.tagName: e.target.tagName;
10
if (clickedTag == "IMG") {
11
alert (alertMsg);
12
return false;
13
}
14
}
15
alertMsg var = "The context menu is not available";
16
document.oncontextmenu = nocontext;
17
/ /]]>
18
</ Script>

The script removes the context menu and replace it with this alert box:


You can change the message to whatever you want in line 15, or
If you do not want the notification box appear at all, just delete the line or comment on it, like this:
/ / Var alertMsg = "The context menu is not available";
Click on any image on this post to see it in action.

b Disable right-click on a single image
To remove a shortcut menu for a single image you need to add this piece of code (shortcut menu event handler) in the img tag:
oncontextmenu = 'alert ("The context menu does not work"); return false; "
Open the message is a text editor, switch to HTML mode, find the img tag image you want to delete and then add the code inside the tag.

For example:

This is the original image tag:
<img Border = "0" />

When you add a context menu event handler, it should look like this:
<img Oncontextmenu ='alert ("Kuvan context menu is reset toimi"); false; "border =" 0 "/>

Enjoy!


By sajib shahik
I am a professional Graphic designer and web site designer.I always try to make my byers Happy with my work and my activities. See My portfolio.....







Stay Connected With Us
Feed Icon Twitter Icon Facebook Icon Google+ Icon Youtube Icon


Share and Spread Share On Facebook +1 This Post Digg This Post Stumble This Post Tweet This Post Tweet This Post Tweet This Post Save Tis Post To Delicious Share On Reddit Bookmark On Technorati


Related Articles

JOIN THE DISCUSSION

Any feedback, questions or ideas are always welcome. In case you are posting Code ,then first escape it using Postify and then paste it in the comments

0 comments: