Detect a touch device with a single line of JavaScript
var touch = ("ontouchstart" in document.documentElement);
Written by Robert Fleischmann
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mobile
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#