Javascript : How To Disable Right Click On Your Website

There are cases where you don’t want mouse right click to work in your website so to do this just add the below piece of javascript code in your website and its done.

  document.oncontextmenu = function() {return false;};
    if( e.button == 2 ) { 
      alert('Sorry, Right Click Has Been Disabled!'); 
      return false; 
    return true; 
Tagged with: ,
Posted in Javascript

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

Follow me on Twitter

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 443 other followers

%d bloggers like this: