What is the iPad user agent?

2019-01-02 17:58发布

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad.

So, can anyone with access to the iPad or the iPad SDK give us the user-agent string?

12条回答
无色无味的生活
2楼-- · 2019-01-02 18:14

From the simulator, in iPad mode:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9 (this is for 3.2 beta 1)

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (this is for 3.2 beta 3)

and in iPhone mode:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g

I don't know how reliable the simulator is, but it seems you can't detect whether the device is iPad just from the user-agent string.

(Note: I'm on Snow Leopard which the User Agent string for Safari is

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10

)

查看更多
余生请多指教
3楼-- · 2019-01-02 18:17

Mine says:

Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5

查看更多
琉璃瓶的回忆
4楼-- · 2019-01-02 18:22

For iPad Only

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
查看更多
明月照影归
5楼-- · 2019-01-02 18:23

From a real device:

Mozilla/5.0 (iPad; U; CPU OS OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10

查看更多
笑指拈花
6楼-- · 2019-01-02 18:26

It seems to be general consensus that every mobile apple device, iphone, ipad, or ipod uses a user agent that contains both 'Mobile' and 'Safari'.

However, using the latest SDK (4.0.1) and reading the user agent on my rails server (using request.env["HTTP_USER_AGENT"]), we never get the 'Safari' part.

No matter whether the request is being made from the simulator or a real device, debug or release, it always looks something like this:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; de-de) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11"

Just no 'Safari'. :-( So we have to use the 'iPhone' part to be sure. That is something apple does not recommend doing.

查看更多
一个人的天荒地老
7楼-- · 2019-01-02 18:33

It's worth noting that when running in web-app mode (using the apple-mobile-web-app-capable meta tag) the user agent changes from:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B405 Safari/531.21.10

to:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405

查看更多
登录 后发表回答