-2

当用户访问您的网站时,是否有办法知道他们使用的是什么类型的设备:计算机、平板电脑或移动设备?例如,当我收到电子邮件时,有时我会看到它说是通过 iphone 发送的;他们怎么知道的?任何帮助或指出我正确的方向都会非常有帮助。

4

1 回答 1

0

Short answer: You can't.

Long answer:

All you have is the information in the HTTP User-Agent header, which usually contains the OS name and version.

Usually, browsers running on Mac OS and Linux send enough information to identify the exact OS. For example, here's my User-Agent header:

Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.7) Gecko/2009030423 Ubuntu/8.10 (intrepid) Firefox/3.0.7

You can see that I'm running Ubuntu 8.10 Intrepid Ibex.

And here's what Firefox and Safari 4 Beta report on my MacBook Pro:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16

Windows browsers, on the other hand, usually only report the OS version and not the specific package (Pro, Business, etc.):

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:x.x.x) Gecko/20041107 Firefox/x.x

I did not write this awnser i copied it from: Detect exact OS version from browser Thanks to: Can Berk Güder

于 2012-12-03T19:53:02.503 回答