In
JavaScript è possibile verificare se un dispositivo supporta il
touch controllando se esite è meno un evento legato al touch, ad esempio
ontouchstart:
var touchEnabled = false;
if (typeof document.ontouchstart === "object") {
touchEnabled = true;
}
console.log(touchEnabled);
se non è supportato, l'espressione
typeof document.ontouchstart ritorna
undefined.