P
P
PatapSmile2012-07-09 16:32:50
iPhone
PatapSmile, 2012-07-09 16:32:50

How to count Javascript clicks in mobile browsers (Android and iPhone)?

I made a promo page that should count visitor clicks ( link ). I'm using jQuery and counting clicks on the mousedown event. Everything works on desktops, but on mobiles and tablets it's somehow clumsy. I have never worked with them, and I can not understand why it does not work.

1. On android (HTC and Samsung) when double-clicking, the browser tries to zoom the page (it does not zoom to the end, but returns to its original view). User zoom disabled:

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">


2. The iPhone misses some clicks (perhaps it considers them taps or something else). Especially if you click fast.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaliy Petrychuk, 2012-07-09
@vermilion1

Use click instead of mousedown and you'll be fine :)

K
karenishe, 2012-07-10
@karenishe

I advise you to study the touch event events. I strongly recommend not to use standard events like click, and everything that contains the word mouse on mobile devices :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question