1

My website have two versions, for desktop and mobile. The most commom way of determining which version i should display is by checking if touch is enabled, for instance using touch of modernizr.

What I want is that i could display my desktop website even if touch is enabled, for some windows notebooks for instance, that are touchscreen but also have a mouse/trackpad. So it would come down to detecting if a mouse/trackpad are present, even if touch events also are. So:

  • Is there any way of doing this?
  • If not, what's the most approximate way?

Just to make it more clear: Most differences are about the UX of input through mouse or touch, like displaying information on mouse hover, and not only layout related.

ariel
  • 15,620
  • 12
  • 61
  • 73
  • 2
    `var hasMouse = confirm('Are you using a mouse or other pointing device (that isn\'t touch)?');` – RobG Jun 28 '17 at 00:39
  • [CSS solution](https://stackoverflow.com/a/14457567/4578017) [reference](https://developer.mozilla.org/en-US/docs/Web/CSS/%40media/any-pointer) – DarkKnight May 10 '18 at 01:35
  • I don't think this is a duplicate: a trackpad is not a touch device. – loominade Oct 28 '21 at 08:49

0 Answers0