Last updated on March 1st, 2022 at 02:53 pm
Then here is a simple method inside the HTML or whatever page you want this to happen just add this oncontextmenu=”return false;” attribute along with the HTML tag not BODY tag as shown below
If you would like to alert some message, add customization or call some functions when user right click, check this tutorial.
In your website code, inside the body tag just replace the regular <html> with the code below
<html oncontextmenu="return false">
Add this code if you would like to have some custom alert messages included
<html oncontextmenu="alert('No Right Click Please');return false">
Tested in Mozilla FireFox, Google Chrome and Safari
It used to work with the oncontextmenu option inside body tag but not anymore. So use the above code within html tag.
<body oncontextmenu="return false;"> (NOT WORKING)
Demo (Try right click on the demo page and it will be disabled)