Detect tablet (in general)

How do you detect if your app runs on tablet or not (in general case)? It is easy to distinguish iPhone/iPad via navigator.userAgent check, but what are solid ways to detect tablet for other OS?

As far as I understand, some popup controls in F7 are converted to popover if window’s width is >= 768 px (considering device pixel ratio).

@nolimits4web It seems to be very helpful to have something like Framework7.device.tablet exposing described behaviour.

Why do you need this? Just use feature detection rather than some specific device. If you need to do something for >=768px width, then it is:

if (window.innerWidth >= 768) {
  // do something