Detecting touch support with JavaScript


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.