How do I prevent users from downloading course files?????

How do I prevent users from downloading course files?????

by Rubina Sheikh -
Number of replies: 16

Hi there . I am using moodle 1.4.4..  on Windows 2000 along with Apache1.3. I would like to know how do I prevent users from downloading course files or how do I disable right_click function on my pages. It should not allow users to copy text or download course files from my site.

Please give me the solution.

Bye

Average of ratings: -
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Ian Semey -
The easiest most pedagogical way is not give a link to the people you want to restrict from downloading, for example by only have the right people to access the course.

I don't think it is polite to show something to a user, that looks like it is available and then have some technique that blocks what the user believes is possible. Like showing a huge delicious sausage to a dog and then eating it yourself.

But maybe you have a good reason?
In reply to Ian Semey

Re: How do I prevent users from downloading course files?????

by N Hansen -
Ian-That dog and sausage simile really made me laugh. The thought of this is really amusing, but in the end I think I see the dog jumping up and biting the hand of the person with the sausage...
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can't! Just to make sure... You can't.

Yes, there are things you can do to prevent right clicks and remove menus and all sorts of things, but they are all trivially easy to get around. The web was never intended for secure delivery like you say you need.. Also note that this is nothing to do with Moodle - the situation is *exactly* the same for any web delivery.

May I ask why you want to do this - there may be other ways of looking at this.
In reply to Howard Miller

Re: How do I prevent users from downloading course files?????

by Rubina Sheikh -

Thankyou for replying.  But what I want to do is whatever course material I am putting on the site should be available only for viewing. It should not be downlaoded by any user. The aim behind doing is to avoid other users from downloading my contents/course files and use it.

In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
If the user can't download the file or content, the browser has nothing to put on the screen. Everything will be somewhere in the cache of your browser, at least on the moment it is displayed. By protecting your course with a key, you can prevent other people then your students to enter your course and look at your files, but more then that is technicaly not possible.
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Colin Campbell -
You simply cannot do this using the internet. A member of your course can use all the material and download it if they wish. Nothing can stop them. The web is designed to do this. Most people used to use pdf as a means to protect their material but even a pdf can be rendered into a useable resource simply by scanning and OCR. If you hand out your course material as a hardcopy in class, they can do the same. ICT is first and foremost about the low cost of reproducing information.
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
"other users"

Is this really an issue of only letting people in to the course who should be allowed to see it?
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Bill Burgos -
Hi Rubina,

Just to add to the others. There is no way to prevent copying of any material once it is on the screen of the viewer of the computer. Aside from saving the file or the cache of the file, users can also 'screen capture' the visual image on the computer monitor.

This is the double-edged sword of content delivery on the Internet.

What you can do, pedagogically, is to (re)structure the delivery of the course material to have the participants 'create' the material you wish to convey. This would be done, amongst other methods, through forum activity and other interactive techniques.

This might take some extra paradigm shifts from the usual way of teaching. However, there are quite a few that have done it successfully.

Regards,

Bill
In reply to Howard Miller

Re: How do I prevent users from downloading course files?????

by Rubina Sheikh -

Hi Howard,

Thankyou for your suggestion. But I think I have worked it out. I disabled the right click function. This avoids the users from copying or downloading my course files.

Though I have to check is code for all the modules , it is working fine till now.

I wrote the following code in  /moodle/theme/standard/header.html inside the <Head> tag.   

<script language="JavaScript1.2" type="text/javascript">
if (window.Event)
  document.captureEvents(Event.MOUSEUP);

function nocontextmenu() {
  event.cancelBubble = true, event.returnValue = false;

  return false;
}

function norightclick(e) {
  if (window.Event) {
    if (e.which == 2 || e.which == 3) return false;
  }
  else if (event.button == 2 || event.button == 3) {
    event.cancelBubble = true, event.returnValue = false;
    return false;
  }
}

if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);

document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;
//--></script>

Hope this works for all

Bye

In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Tony Hursh -
What happens if the user turns off JavaScript? smile

You may want to have a look at this page which explains:

  • Why attempting to disable right-click is a bad idea
  • Why it doesn't work anyway


In reply to Tony Hursh

Re: How do I prevent users from downloading course files?????

by N Hansen -
Here's my favorite article on this topic:

http://www.karlcore.com/articles/article.php?id=18


The thing that is annoying me lately is websites that disable your back button. It's like they want to force you to stay on their site. The worst of this kind of site are the ones that are so paranoid that they disable the back button so you can't even use it to navigate back through their own site!
In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No really - this doesn't work. What if they turn off JavaScript? What if they just do a screen dump of the page? What if they print it and scan it later?

Take our advice - forget it! I'm really not trying to be nasty, but this isn't going to work out for you. You might make it *harder* to download your files, but not much harder.
In reply to Howard Miller

Re: How do I prevent users from downloading course files?????

by Andy Diament -

Is it my imagination or are there ways of controlling the browser so that a page will prevent copying text or right clicking and copyign images. I'm sure I've come across pages that have enabled this, e.g. to protect images. I know you can still print or screen dump..... and agree it would take a lot of effort for limited results

Andy D

In reply to Andy Diament

Re: How do I prevent users from downloading course files?????

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No there isn't. You can fudge it with JavaScript (as has been suggested) - but it is trivially easy to circumvent. Turn off JavaScript, use wget, anything like that!
In reply to Howard Miller

Re: How do I prevent users from downloading course files?????

by Ravi M -
HI

i have found some code by searching the web

it will disable right click , selection of text , and file->print or (ctrl + p) prints a blank page...

Please note that if you have opened window containin the folowing code .... your copy paste in other applications also will not work.....

hope this will help some body


<SCRIPT LANGUAGE="JavaScript">
<!--
hp_ok=true;
function hp_d00(s)
{
if(!hp_ok)return;
document.write(s)
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function hp_ne()
{
return true
}
onerror=hp_ne;
function hp_dn(a)
{
return false
}
function hp_cm()
{
//alert("\u0054\u0068\u0069\u0073\u0020\u0070\u0061\u0067\u0065\u0020\u0068\u0061\u0073\u0020\u0062\u0065\u0065\u006E\u0020\u0070\u0072\u006F\u0074\u0065\u0063\u0074\u0065\u0064\u002E\u0020\u0050\u0072\u0065\u0076\u0069\u0065\u0077\u0020\u006F\u006E\u006C\u0079\u002E");
return false
}
function hp_de(e)
{
return(e.target.tagName!=null&&e.target.tagName.search('^(INPUT|TEXTAREA|BUTTON|SELECT)$')!=-1)
};
function hp_md(e)
{
mac=navigator.userAgent.indexOf('Mac')!=-1;
if(document.all)
{
if(event.button==2||(mac&&(event.ctrlKey||event.keyCode==91)))
{
//alert("\u0054\u0068\u0069\u0073\u0020\u0070\u0061\u0067\u0065\u0020\u0068\u0061\u0073\u0020\u0062\u0065\u0065\u006E\u0020\u0070\u0072\u006F\u0074\u0065\u0063\u0074\u0065\u0064\u002E\u0020\u0050\u0072\u0065\u0076\u0069\u0065\u0077\u0020\u006F\u006E\u006C\u0079\u002E");
return(false)
}
}
else
{
if(e.which==3||(mac&&(e.modifiers==2||e.ctrlKey)))
{
//alert("\u0054\u0068\u0069\u0073\u0020\u0070\u0061\u0067\u0065\u0020\u0068\u0061\u0073\u0020\u0062\u0065\u0065\u006E\u0020\u0070\u0072\u006F\u0074\u0065\u0063\u0074\u0065\u0064\u002E\u0020\u0050\u0072\u0065\u0076\u0069\u0065\u0077\u0020\u006F\u006E\u006C\u0079\u002E");
return false
}
else if(e.which==1)
{
window.captureEvents(Event.MOUSEMOVE);
window.onmousemove=hp_dn
}
}
}
function hp_mu(e)
{
if(e.which==1)
{
window.releaseEvents(Event.MOUSEMOVE);
window.onmousemove=null
}
}
if(navigator.appName.indexOf('Internet Explorer')==-1||(navigator.userAgent.indexOf('MSIE')!=-1&&document.all.length!=0))
{
if(document.all)
{
mac=navigator.userAgent.indexOf('Mac')!=-1;
version=parseFloat('0'+navigator.userAgent.substr(navigator.userAgent.indexOf('MSIE')+5),10);
if(!mac&&version>4)
{
document.oncontextmenu=hp_cm
}
else
{
document.onmousedown=hp_md;
document.onkeydown=hp_md;
}
document.onselectstart=hp_dn
}
else if(document.layers)
{
window.captureEvents(Event.MOUSEDOWN|Event.modifiers|Event.KEYDOWN|Event.MOUSEUP);
window.onmousedown=hp_md;window.onkeydown=hp_md;
window.onmouseup=hp_mu
}
else if(document.getElementById&&!document.all)
{
document.oncontextmenu=hp_cm;document.onmousedown=hp_de
}
}
function hp_dp1()
{
for(i=0;i<document.all.length;i++)
{
if(document.all[i].style.visibility!="hidden")
{
document.all[i].style.visibility="hidden";document.all[i].id="hp_id"
}
}
};
function hp_dp2()
{
for(i=0;i<document.all.length;i++)
{
if(document.all[i].id=="hp_id")document.all[i].style.visibility=""
}
};
window.onbeforeprint=hp_dp1;
window.onafterprint=hp_dp2;
document.write('<style type="text/css" media="print"><!--body{display:none}--></style>');
function hp_dc()
{
hp_ta.createTextRange().execCommand("Copy");
setTimeout("hp_dc()",300)
}
if(navigator.appName.indexOf('Internet Explorer')==-1||(navigator.userAgent.indexOf('MSIE')!=-1&&document.all.length!=0))
{
if(document.all&&navigator.userAgent.indexOf('Opera')==-1)
{
document.write('<div style="position:absolute;left:-1000px;top:-1000px"><input type="textarea" name="hp_ta" value=" " style="visibility:hidden"></div>');
hp_dc()
}
}
function hp_ndd()
{
return false
}
document.ondragstart=hp_ndd;
//-->
</SCRIPT>

In reply to Rubina Sheikh

Re: How do I prevent users from downloading course files?????

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
To re-emphasise what others have said, if you present information on a web page, people will be able to make copies of that information. I would be happy to lay a bet giving odds of 10 to 1 that if you give me any group of about 30 students over the age of 16 and tell them you have set up web content that cannot be copied, at least one will, be able to make a copy. It is the absolute nature of the personal computer and web technology in particular, to make perfect digital copies of content it can access. To believe otherwise is to misunderstand the nature of the computer and web technology.

The absolute best you can hope for is to discourage those less technically curious or able to copy your content. If your content becomes useful or important enough it will be copied. So, is your content useful or important?