HTML page disable copy/paste

R.Subramanian picture R.Subramanian · Feb 13, 2014 · Viewed 127.2k times · Source

In a HTML page user should not be allowed to copy a text, but at the same time I want to give option for the user to select a particular text (for highlighting purpose). That means CTRL+C should be disabled and CTRL+A should be enabled.

Can anyone tell me how to do this?

Answer

roo2 picture roo2 · Feb 13, 2014

You cannot prevent people from copying text from your page. If you are trying to satisfy a "requirement" this may work for you:

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

How to disable Ctrl C/V using javascript for both internet explorer and firefox browsers

A more advanced aproach:

How to detect Ctrl+V, Ctrl+C using JavaScript?

Edit: I just want to emphasise that disabling copy/paste is annoying, won't prevent copying and is 99% likely a bad idea.