You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was doing some searching and came across a few possible techniques. There is going to always be an edge case but I feel like we could at least cover some of the easy ones.
functiondetectDeviceType(){if(window.navigator.maxTouchPoints>0){console.log("User is on a touch device.");}else{console.log("User is on a device with a mouse.");}}detectDeviceType();
Or possibly
functiondetectInputMethods(){consthasTouch='ontouchstart'inwindow||navigator.maxTouchPoints>0;consthasMouse='onmousemove'inwindow;consthasPointer=window.PointerEvent||window.MSPointerEvent;// Check for PointerEvent (modern browsers) or MSPointerEvent (IE)console.log(`Touch support: ${hasTouch}`);console.log(`Mouse support: ${hasMouse}`);console.log(`Pointer support: ${hasPointer}`);}detectInputMethods();
Really trying to find a simple solution that doesn't require library.
We should use "tap" instead of "click" when on mobile device.
The text was updated successfully, but these errors were encountered: