Click here to Skip to main content
16,019,593 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to prevent users' copy/paste actions in a html input field?
Posted
Updated 31-Jan-17 19:07pm

Try the fix given here[^]. Note that it only works for IE.
 
Share this answer
 
Comments
Subir Saw 26-Mar-12 7:26am    
I am trying this in IE9, it doesn't work in here...
You can find hundreds of JavaScripts to do this if you Googled. Some of them works for some browsers and others work in other browsers. But eventually you will come up with a solution that works on almost every browser.

But that's not the point. All these implementations are done using JavaScript. If the intent of restricting copy/paste is to protect your site's content, I say it's a lame approach. Firstly, user can disable JavaScript. Secondly, he can view source. And above all, since all the data is sent to the client side already, there are about fifty million ways to recover that data if the user really needs them.

So my advice, do not waste your effort for so small a result.
 
Share this answer
 
In <input tag (just write the code : oncopy="return false" onpaste="return false" )
html doesn't allow to copy or paste data from the input field.
 
Share this answer
 
Comments
Richard MacCutchan 1-Feb-17 6:43am    
Please do not post in questions that are almost FIVE years old.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900