How to disable right click in Moodle

Disabling right click is a stupid way of protecting one’s content. If your browser able to read the content, so does the user. The user able to download / copy or do whatever they want to do. That’s a fact!


However if you are a Moodle user, you may noticeĀ  ‘Save Video as’ option on Chrome for your videos as annoying.

There is many other suggestions such as embedding the content using iFrame etc to prevent content download. However such method will prevent users from using offline reading feature in Moodle mobile.

So here is a simple way of preventing right click on your Moodle site;

Go to Site Administration => Appearance => Additional HTML

Add the following code in When BODY is opened section;

<script language=JavaScript>
var message=”Function Disabled!”;
function clickIE4(){
if (event.button==2){
return false;
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
if (document.layers){
else if (document.all&&!document.getElementById){
document.oncontextmenu=new Function(“;return false”)
// –>
That’s it!