Disable double click for HTML links

On August 31, 2010 · 0 Comments

I’ve got a bunch of users that constantly double click html links. Also, I’ve had a few users probing my apps trying to expose holes. Those probes have generally included either clicking links multiple times, or automatically submitting URLs via some automated process.

When I added messages to guide users that were re-submitting the same URLs, the double click users showed up as potential offenders. I needed a way to keep the double click users off of my intrusion detection report, but still be alerted to the more nefarious users. The solution to this problem is preventing browser based double clicks

I think my solution is elegant. I didn’t find this solution on the Internet, so I decided to post it here.

Simply make the onclick handler for the <a> tag reset it’s onclick handler to return false:

<a href="#" onclick="this.onclick=function () {return false;};return true;">Click Here</a>

I’ve tested this in Chrome/FF/IE8/IE6 and they all seem to work just fine. Comments and feedback welcomed.


Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word