What is the best way to detect a mobile device?
Asked 07 September, 2021
Viewed 2.3K times
  • 48
Votes

Is there a way to detect whether or not a user is using a mobile device in jQuery? Something similar to the CSS @media attribute? I would like to run a different script if the browser is on a handheld device.

The jQuery $.browser function is not what I am looking for.

30 Answer