在 Ruby 中检测 iPad 3 [英] Detect iPad 3 in Ruby

查看:51
本文介绍了在 Ruby 中检测 iPad 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 ruby​​/rails 检测 iPad 3(又名新 iPad)?如果是这样,我将如何去做?

Is it possible to detect an iPad 3 (aka The new iPad) using ruby/rails? If so, how would I go about doing it?

推荐答案

您可以检测设备,但我认为无法检测设备版本.据我所知,Apple 提供了一个用户代理字符串,如下所示:

You can detect the device but I do not think it is possible to detect device version. As far as I know, Apple provides a user agent string which appears as follows:

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

此字符串中没有机器版本信息,我不知道其他检测用户机器的方法.

There is no machine version information in this string and I do not know any other way to detect user machine.

如果您不知道如何在 Rails 中获取用户代理字符串,请查看此处.

If you do not know how to get user agent string in Rails, check here.

这篇关于在 Ruby 中检测 iPad 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆