Friday, January 1, 2016

Dealing with web browser click delay when developing apps or web pages for mobile devices

When developing apps or web pages for mobile devices, there are a lot of factors to take into consideration: operating system, device manufacturer and model, web browser, etc.  One thing that I recently discovered is that there can be a 300ms delay when using the touch screen on many mobile devices.

If you develop code and test it on a laptop or desktop, you won't notice this delay, and may think everything is working perfectly (as I did).  That delay may not be noticeable for some apps or web pages, but for others (especially ones that require a quick response, like a game) it can cripple the functionality or destroy the gaming experience.

This article on SitePoint.com has several good solutions for dealing with this delay.  Some of them will work for some devices, operating systems, or web browsers but not for others.  I can attest that the touchend method works great for the iPad and iPad Mini... it completely removed the delay that occurred when using the onclick attribute.  It's possible that you may run into a problem eventually if you include both the onclick and touchend attributes calling the same function, but I haven't had that happen yet.

No comments:

Post a Comment