How do I detect whether a browser supports mouseover events?
var supportsTouch = (typeof Touch == "object");
Just detect if it's a touch device and then do your special stuff. This is the simplest approach since most touch devices emulate mouse events but no mouse driven device emulates touch events.
Update: Considering how many devices there are now a days and Johan's comments I'd recommend simply using Modernizr.
This method catches more devices/browsers
try {
document.createEvent("TouchEvent");
alert(true);
}
catch (e) {
alert(false);
}
Read more