有没有一种方法来检测的Rails 3.1的用户代理 [英] Is there a way to detect user agent in Rails 3.1

查看:141
本文介绍了有没有一种方法来检测的Rails 3.1的用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  自动检测移动浏览器(通过用户代理?)结果
  的Rails 3:HTTP_USER_AGENT

有没有办法从当前访问者检测用户代理?我目前工作的一个项目,以显示视频文件。但对于iPad,iphone /三星Galaxy Tab / IE浏览器/ Firefox浏览器。我需要显示视频的是有检查哪​​些浏览器访问我的Rails应用了坚实的方式?

Is there a way to detect the user agent from a current visitor? I'm currently working on a project to display video files. But for the ipad, iphone / samsung galaxy tab / internet explorer / firefox. I need to display video's is there a solid way to check which browser is visiting my rails app?

谢谢你们!

推荐答案

是的,只要使用此

request.env["HTTP_USER_AGENT"]
#or
request.user_agent

这篇关于有没有一种方法来检测的Rails 3.1的用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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