How to disable right click menu on website

Many people are working on their website and they want to build more and more feature in their website. For them I am describing a method to make your website better.

Now a days many website have a feature that we can’t copy or paste from that site, even we are unable to perform a right click. It is a very attractive feature. You can enable it in your website by doing these simple steps. There are two methods the first one is: How to disable Right Click and the second method is: How to disable copy and paste by using shortcut keys ctrl+x, ctrl+c and ctrl+v.

Here I am showing you the steps to disable Right Click on your website. I will describe the method of disabling copy and paste in another blog.

Some people told that you must have the knowledge of JavaScript. But I am not believing on this line. Anyone can try it and use it.
To perform these steps you should know the home page and its header tag of your website. Now moving towards its steps:

Step 1: Open the home page of your website in any text editor. If you are editing offline then I will prefer Notepad++ which can be downloaded from the link It is a free software.

Step 2: Go to your title tag under head tag area. You can find it on the beginning of the codes of that line. It is the best zone to write JavaScript.

Step 3: Type these codes in that area.

< script type="mce-text/javascript">
if (document.layers) {
//Capture the MouseDown event.

//Disable the OnMouseDown event handler.
document.onmousedown = function () {
return false;
else {
//Disable the OnMouseUp event handler.
document.onmouseup = function (e) {
if (e != null && e.type == “mouseup”) {
//Check the Mouse Button which is clicked.
if (e.which == 2 || e.which == 3) {
//If the Button is middle or right then disable.
return false;

//Disable the Context Menu event.
document.oncontextmenu = function () {
return false;

Step 4: Now save this file and upload it to your website by using control panel or FTP account which you like.

Step 5: Now go to your website and perform a right click. You can’t see any option from right click menu. Its 100% working method.

Note: This code is only written in your home page so it work on home page only. You have to write it in all pages of your website. The simple way is to add a header file in your website.

I will describe the use of header file in my other blog. For now enjoy your website with this new feature.


Leave a Reply

Your email address will not be published. Required fields are marked *