How to forbid COPY, CUT and PASTE operations on a webpage

There are 3 controls for it-

  1. oncopy
  2. oncut
  3. onpaste

Sytax:

Say you want to forbid copy operation  on a textbox element. Use the following-

<input type=text oncopy="return false">

Similarly to forbid cut & paste operations on a textbox use oncut="return false" and onpaste="return false"

N.B.: This restriction can also be applied on the whole document by applying it on the <body>-element as follows-

<body oncopy="return false">

This is widely used to fight piracy. So very necessary at times

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s