编辑:在移动Safari浏览器我想测试IOS版本,iOS的说8的Rails:在移动Safari浏览器IOS版本检测生产环境
鉴于request.user_agent
回报:
的Mozilla/5.0 (iPhone,CPU iPhone OS 8_1_2,例如Mac OS X)...
做这些方法看起来足够(编辑:具体来说,就是正则表达式SOU ND)?
def ios_device?
!!request.user_agent.match(/iphone|ipad|ipod/i)
end
def ios_8?
is_ios_device && !!request.user_agent.match(/OS 8_/)
end
为什么有人想在2015年测试iOS 3? – 2015-02-08 01:50:18
@heading_to_tahiti您的评论更具相关性吗?数字3是假设的。 – gr8scott06 2015-02-09 02:40:08