Tuesday, February 7, 2012

Disabling Context Menu

I am a pro-blogger and a part time web-developer. In one of my past website projects what happened were that one of my clients wanted to remove the right-click option (Context Menu) from the web pages so that people wouldn’t be able to copy the images and texts. I tried to convince him that it’s of no use as there are many other ways you can copy them even if you disable the option. Still he wasn’t willing to listen to me and I was left with no option than to look for the JavaScript code (that’s what I thought would disable the Context Menu). I thought there would be at least few lines of JavaScript code for it but to my surprise there was just a line to disable the menu that appears on the right click on the browser.

Here the code which you have to add in the body tag of the document

The code does nothing more than just what is needed means it blocks the context menu which appear after right clicking anywhere in the browser.

No comments: