July 3, 2012

How to Disable Right Click Menu on Your Website

Have you ever thought you wanna get rid of right click menu on your blog / website to secure the content? It is not a compulsory action, but mostly the reason would be preventing content scrappers from copying your content. Were you fortunate enough to keep away from content scrappers?

It's alright if someone re-publishing your content with your permission. But sometimes, people who are lack of ideas and certain qualities which possessed by good bloggers and writers, are trying to copy content of someone else to keep the flow of traffic coming in.

Can you think of someone copying your "About Me" page and using same on their blog? Believe me, there are people who does that. Also right click menu allows people to easily access your site's source code too. So you may wanna keep some information just to read but not to copy or use for their work, without explicit requests. In such a situation, would you mind disabling right click menu on your site?

What's the Big Deal?

Disabling right click menu doesn't mean anything? It doesn't matter if you have no content that you don't need others to copy from your blog or website. Sometimes content may have copied to share among their friends. If your content linked with other pages on your site, you can find it beneficial too.

If you remember we have discussed a great way for you to
benefit from content being copied on your blog or website. Or simply you can implement share buttons on your blog or website for users to enforce sharing using share buttons.  There are few reasons I can think of that you may need to disable right click menu on your blog, website or on a specific page,

● Prevent copying text easily on the page

● Prevent saving images on your page

● Prevent viewing source code easily of your page

● Prevent saving your page

However disabling right click menu doesn't mean you have beaten content scrappers totally. Anyway for content scrappers, there are some alternative ways to gain access to your content. However disabling right click would be first step in that scenario. Disabling right click menu is depend on the intention you've got. Mostly here I'd like to imply that it's not about preventing copying all content on your site. But if you have some information that is valuable or sensitive and you just wanna make sure that it's only to read, you can make use of disabling right click menu to be safer and accomplish your objective.

How It Works

Here, it is a script that disable right click menu on your site. This script will look out for right click action happen on the page and whenever an user right clicks on your page, the script will block it and raise a user friendly message for visitors.

Also you can customize the message displayed for users too. However the downside of disabling right click menu would be preventing accessing other functions on the right click menu. Yeah, disabling right click menu is not intend to interfere with visitors. Anyway mostly right click menu would be used to copy and paste content. So it won't be a major problem for users.

But as far as it's your concern and if you think securing content is far more important at the moment, it's your choice to implement right click menu disabling script on your blog or website. Think of "User Experience vs Security" and then it's your call.


You just need to add below script to your website or on specific page you wanna disable right click menu. Make sure to add this script just after the <body> tag or right before </body> tag.

Note: If you are a Blogger user and don't know how to edit your template, read How to Edit Your Blogger Template.

<script type="text/javascript">

var message="Right Click Function Disabled!";

function clickIE4(){
if (event.button==2){
return false;

function clickNS4(e){
if (document.layers||document.getElementById&amp;&amp;!document.all){
if (e.which==2||e.which==3){
return false;

if (document.layers){
else if (document.all&amp;&amp;!document.getElementById){

document.oncontextmenu=new Function("alert(message);return false&quot;)


Color Indication Information:

   - Pop-Up Message

This is the message displayed whenever an user tries to right click on your page. You can specify an informative or descriptive message here to display for users.

More Information:

* If you're a Blogger user and wanna implement right click disabling script for specific pages, read How to Show/Hide Elements on Different Pages in Blogger.

Credits: The credit of offering this Right Click Disabling script should goes to Maximus and moderators at DynamicDrive.com.

Enjoy :-)

Awesome! Thanks for coming by and taking your time to read this post :) I hope you have learnt something today. Now you can share it with your friends and I'd love to hear from you too.

Related Posts and Categories

Category, , , , , ,


* If you got any questions not related to this post, please ask it at our Support section.

* Make sure your comment is genuine and comply with our commenting guidelines.

* Review your email and reply notification settings to receive replies via email.

* Experiencing problems when commenting? Please report them at our Support section.

Lisa said...

Fascinating Mayura, does that mean the images could not be pinned as well? Something to think about. 

Mayura De Silva said...

No Lisa :) Images will be able to pin and only right click menu will be disabled. So users can't make use of right click menu on your site. BTW if you wanna prevent pinning, you can use Pinterest blocking tag on your blog just to prevent pinning images & videos on your site :)

I hope it helps you to figure out, isn't it? :)


Brenda said...

Personally, I have stumbled across some blogs where their SHARE buttons don't work correctly, work at all, or don't have them. By me being able to right-click, I can still share using my Add+This chrome plug in.

Mayura De Silva said...

Hi Brenda,

Oops... So right click menu matters there :) However you can click on AddThis chrome extension to share except for right click menu. Isn't it Brenda?

Anyway blogger or webmaster needs to think about "User Experience vs Security" ;)


Brenda said...

True, you can do that too, but I'm a huge right clicker. I like being about to right-click to Print, Share, Translate, send to Evernote Web Clipper, and Save. Just my personal experience. I figure, if people want your content bad enough, they'll find a way. :)

Mayura De Silva said...

Ohw wow... You're absolutely fond of right click menu :) Really thanks for sharing about 'em dear. I definitely believe users who wanna implement right click disable script might think about these before the implementation. At least they will focus on pages they never wanna let others share content such as static pages where sensitive data relies :)

Thanks for adding your valuable ideas on it dear :)


Adrienne said...

I was introduce to this I believe it was last year Mayura but I know that for those that really want to copy your content or images, they'll find away around that so I just didn't even want to bother with that.  

I've visited a few sites though that have this implemented so to each his own right.

Thanks for teaching us how to do this if we want.  Great to know.

Enjoy your weekend my friend and hope you have some fun.


Mayura De Silva said...

Hi Adrienne,

Yippy dear :) I have to agree with you. Sometimes users may find it irritating and also content scrappers can try out alternative solutions on it. As I think if you have a specific page where you wanna disable right click menu for specific reason such as to prevent viewing source code, it may be really useful. We won't know until we need it. So better to know and come back later on when we need it :)

Thanks for your thoughts on it dear and always value 'em...

You have a great weekend too my friend :) And don't forget the fun part...


Kreative Freelancer said...

Dude tell me the text in HTML after which i should paste this coding of yours. 

Mayura De Silva said...

Hi Mate,

Just copy it after or before tag as you prefer. That's all :)

Jeetendra Bankapure said...

This is simply awesome....
the only issue am facing now is that the message i've kept in Marathi for which its displaying with ढ&#2366 and other numbers.....how to get rid of this issue?

Mayura De Silva said...

Hi Jeetendra,

Glad to hear it was helpful! Just remove the set of words highlighted with green color mate :) You are good to go.


Jeetendra Bankapure said...

Hey Mayura, actually i need the "Right Click function disabled" to be changed with "ढापा-ढापी करायची नाही ...हं" which actually displays the following message :

Mayura De Silva said...

Hi Jeetendra,

Oops... Unfortunately, you gotta go with English there mate :) The script has no localization options to allow other languages.

I hope you are trying to use Hindi or something. Anyway, if the reader uses Hindi as the default language in his computer, the message will be automatically converted to Hindi too.