The Blog

Distinguish real click (user) from generated-automated with jQuery.

12 Apr 13

How to distinguish real clicks from automated (programmatic) clicks with jQuery?

“Real” clicks: clicks generated by users.

Automated clicks: clicks generated by other javascript methods (ie jQuery click(function() { } );
[code lang=”javascript”]
<script type=”text/javascript”>
$(“#foo”).click(function(e){
if(e.hasOwnProperty(‘originalEvent’)) {
// Click Reale
} else {
// Click Generato
}
});
</script>
[/code]

Hope it helped 🙂

Italian Version

Comments