Determine and bind click or "touch" event
I would strongly suggest against using UA in order to determine whether you're under touch environment.
Use Modernizr instead: http://modernizr.com/The below code would recognize anything but windows phone 7 because the windows phone 7 does not fire the regular browser touch events. However WP8 would most probably be recognized correctly.
if (Modernizr.touch){ // bind to touchstart, touchmove, etc and watch `event.streamId`} else { // bind to normal click, mousemove, etc}
This may work for you:
var clickEvent = ((document.ontouchstart!==null)?'click':'touchstart');$("#mylink").on(clickEvent, myClickHandler);
Both iOS and Android have touch events, but Windows uses MSPointer events in IE. If you want a cross-device solution, try pointer.js or learn from it: