I have a button on my website that I really need to check if the user actually clicked on it (for now I am not considering accessibility or disabled people that may use other input systems). I have an onclick
event handler attached to the button element.
What type of condicional can I execute on the top of the event handler so I can make sure only people who actually pressed the button using the mouse (not keyboard press) and only the mouse? I also want to detect people that fire onclick
event manually from javascript console.
Is there a way I can reliably check if the mouse clicked on my button?
Note: I know there are tons of softwares that automate clicks on several OS. That's not a problem cause those automation tools execute an ACTUAL CLICK (the cursor is moved over the element and clicked). So no problem accpeting those clicks.
EDIT: the MARKED AS DUPLICATED inserted into this question has ABSOLUTELLY NOTHING TO DO WITH IT. I want to check if the onclick event was fired by human manipulating the mouse VS direct triggering/programming triggering/keyboard trigerring.