Device supports touch events
JavaScript, Browser · Oct 22, 2020

Checks if touch events are supported.
- Check if
'ontouchstart'
exists in theWindow
.
const supportsTouchEvents = () =>
window && 'ontouchstart' in window;
supportsTouchEvents(); // true