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.


Steps:

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){
alert(message);
return false;
}
}

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

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&amp;&amp;!document.getElementById){
document.onmousedown=clickIE4;
}

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

</script>

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, , , , , ,





Comments

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

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