Modernizr Touch tests

This page tests various approaches to detecting Touch events / touch support in the browser. Please visit this test page with any touch devices you have, so that we may include a reliable Modernizr.touch test in our next major release! Your results will be automatically submitted. More details on our touch support

Update 2010.08.10: `ontouchend in document` test added.

Update 2013.01.04: This page is somewhat outdated. The current discussions around touch and handling it are at http://code.google.com/p/chromium/issues/detail?id=152149, https://github.com/Modernizr/Modernizr/issues/548, and https://github.com/Modernizr/Modernizr/issues/753 Also: window.Touch (used below) is a constructor not an object so that should always fail.

Your browser's results:

'ontouchstart' in window try/catch {
   document.createEvent(
"TouchEvent");
}
'createTouch' in document typeof TouchEvent != "undefined" typeof Touch == "object" "ontouchend" in document NW.Event
.isSupported('touchstart')

Thanks! Follow Modernizr on github



Results Summary

Most used to false positive in Chrome 4-5. That bug was fixed. Below are the possible solutions and notes on each.
    'ontouchstart' in window
    "ontouchend" in document
    try { document.createEvent("TouchEvent"); }	 catch(e){}
Same results with the three of these.
    typeof TouchEvent != "undefined"
No good. False positives in Chrome 6-7.
    'createTouch' in document
    typeof Touch == "object"
No good. Same results with these two. Fails in BB6, Android 1.5-2.2.

Untested solution: nwevents touch detection via isEventSupported

Full data table