根据用户代理字符串检查是否移动

Check if mobile or not based on User Agent string

一种检查方法可以基于设备宽度,但这绝对不是具体的。是否有任何 UA parsers/libraries 可以帮助根据用户代理字符串识别此问题?

谢谢!

如果您需要知道您的设备是否是 mobile/desktop/tablet,UADetector http://uadetector.sourceforge.net/ 有一个非常好的设备分类:

Since version 0.9.10 we support device categorization which means that for instance an iPhone or Nexus 4 will be classified as Smartphone and an iPad, Kindle or Surface RT as Tablet