Posted by jynx_cj on October 7, 2012 at 12:39pm
Is there any way to disable the CTRL+C command for certain user roles?
I want to disable it for all user roles except for administrators as administrators need to use it quite often.
This will help somehow reduce the content theft.
Comments
=-=
is content available to anon users ? if so, then the idea is pointless. beyond that screen captures can be acquired even if CTRL-C is disabled.
Sure, it's not effective, but they did ask.
Yes, it's a little silly, but if it makes them feel better (and perhaps dissuades a few people from copying content because of the slightly increased difficulty...) why not?
To make an example, let's say you only want to disable CTRL+C for anonymous users. You'll need to add some code to the head of your page template that goes something like:
<?php
global $user;
if($user->uid == 0){
print "<script style="text/javascript">
function onKeyDown() {
var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
if (event.ctrlKey && (pressedKey == "c" ||
pressedKey == "v")) {
event.returnValue = false;
}
}
</script>";
}
?>
And, similarly, add an onload attribute to your body tag that calls onKeyDown();