Lock CTRL key on All Browsers

1

I want to Protect my Content. I've already "Destroyed" the Right Click on my Site, But now I would like to lock the CTRL key. Because it gives rise to copy and paste commands, and I do not want to use it on my site. Is there any code to override the CTRL key? Thank you.

    
asked by anonymous 22.05.2015 / 02:59

4 answers

1

Although it is against this kind of technique, if you add this CSS rule in the element you want to block it should work

p.no-copy{
  -webkit-user-select: none;  /* Chrome Todos / Safari Todos */
  -moz-user-select: none;     /* Firefox Todos */
  -ms-user-select: none;      /* IE 10+ */
  -o-user-select: none;
  user-select: none;  
}
    
23.05.2015 / 01:03
11

Can not protect text from your site.

These measures are completely artificial, they are just an ugly trick with JavaScript. Anyone with JavaScript disabled can do as they please. There are many other ways to get text even if you could block Ctrl , for example: download the page via curl , display the source code of the page, use the browser web browser.

By the way, prohibiting users from copying texts would be inelegant and goes against the open and democratic principle of the web. On the internet, information should move freely.

Imagine that a user wants to save a passage for themselves, or simply search for the definition of a word in an online dictionary. If you block the copy, it only harms that user, the layman, who does not plan malice. The experienced user, who wants to steal the text from your site, would use the techniques I've commented on.

    
22.05.2015 / 03:14
2

You can prevent them from "copying" your site using oncopy and oncut :

<body oncopy="return false" oncut="return false">

Keep in mind that this will make it impossible to copy and paste also elements input[type=text] and textarea .

However, in my opinion, it's really annoying when some site does this, as well as being easy to get over those restrictions.

    
22.05.2015 / 03:35
0

You can use oncopy="return false" or oncut="return false" but not all browsers support it. An alternate form that works on all would be:

window.onkeydown = function() {
   var key = event.keyCode || event.charCode || e.which;
   if(key==17){ alert('Proibida copia deste site.'); return false; }
}

The window.onkeydown event is used to detect the key that was pressed, which receives the identifier methods keyCode , charCode on event and which . Both event return parameters, but different in MSIE, Webkit and Genko. The alert does not allow execution of the next key, and return cancels execution.

    
29.05.2015 / 15:02