Possible Duplicate:
Auto detect mobile browser (via user-agent?)
Rails 3: HTTP_USER_AGENT
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?
Thanks guys!
Yep, just use this
request.env["HTTP_USER_AGENT"] #or request.user_agent
What about using a simple gem?
If I remember well, I used this one last time.
gem install user-agent
The same one on GitHub
I think that this is a good way to do it...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With