Jump to content

Right click block


duke

Recommended Posts

Blocking right-clicking doesn't work. There are so many other ways to grab your content besides right-clicking. Right-click blocking scripts were abandoned by decent web developers a decade ago.

function blockRightClick(e) {    e = e || window.event;    if (e.which && e.which == 3 || e.button && e.button == 2) {	    if(e.preventDefault) e.preventDefault();	    return false;    }}

Then apply a mousedown or mouseup event on the element:

element.onmouseup = blockRightClick;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...