I’m trying to prevent information to be copied from a page (for non-technical users of course). I know how to disable selecting text using the mouse. The following jquery code works:
$(function(){
$.extend($.fn.disableTextSelect = function() {
return this.each(function(){
if($.browser.mozilla){//Firefox
$(this).css('MozUserSelect','none');
}else if($.browser.msie){//IE
$(this).bind('selectstart',function(){return false;});
}else{//Opera, etc.
$(this).mousedown(function(){return false;});
});
});
$('.noSelect').disableTextSelect();
});
But users can still use Ctrl+A to select the entire page. Any workarounds for this?
this code works for every combination of ctrl+key you want
65 is the ascii code of ‘A’
add 97 if you want to check also for ‘a’
Should works, I wrote it directly without testing..