How to disable Right Click on your web page

In this post, we will see how we can disable right click option using simple JQuery code. I hope you will like it.


Most of the developers are always looking for the safety of their images and code blocks which they have shared in the web. But normally it is hard to secure this unless you go for any third party tool. Some of us may think if we just disable the right click option in our page, makes the content secured. But it is not. If some one really thinks that they need to get the content from your page, they can achieve it. Even though that is the reality, I am sharing this post to show how to disable the right click option in page.


We are going to use JQuery for this requirement. So you need to load the JQuery reference first.

<script src=""></script>

Now we need to add the needful script.

$(document).ready(function() {
         return false;

Here what we did is, whenever user tries to perform right click in the document, we are restricting that. We are applying this restriction to the entire document. And we use contextmenu event to do this requirement.

That is all. Everything is done and set. Now you need to see the output and demo right?


You can see a demo here Disable Right Click Demo


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s