Detecting touch support with JavaScript

Don't.

Or do, but don't do it exclusively. Don't lock yourself into the "touch version" of your site and the "mouse version." When you bind an event handler, don't do a if( 'ontouchstart' in document.documentElement){...}else{...} because many devices these days are both touch and mouse-enabled.

The video below does a pretty good job of explaining the problem.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.