I'm trying to find a script that can block people simply copy'n'pasting things in forms .. I've got elements for people to confirm their password and email address .. and at a client's site yesterday it became clear that at least one user was entering their email address, copying it, and pasting it into the confirmation box. Kind of makes the whole thing a bit pointless..
Is there a way to stop pasting via javascript?
JavaScript to block paste
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
There is no definitive way I am aware of.. On the newer browsers you can hook the paste event, but it only takes a few clicks to disable Javascript if someone really wants to get around it.
Although it may penalize people that type excessively fast, you could look at using a change rate test. i.e. poll the fields for their value at a ~quick rate (30ms). If the value changes significantly since the last poll (like 3-5 characters) deny the change or something...
Although it may penalize people that type excessively fast, you could look at using a change rate test. i.e. poll the fields for their value at a ~quick rate (30ms). If the value changes significantly since the last poll (like 3-5 characters) deny the change or something...