0.12
A long-lived project that still receives updates
Parses user agent strings and boils it all down to a few simple classifications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Build Status Gem Version

BrowserSniffer

Description

Parses user agent strings and boils it all down to a few simple classifications.

Installation

Add this line to your application's Gemfile:

gem "browser_sniffer"

And then execute:

$ bundle install

Or install it yourself as:

$ git clone https://github.com/Shopify/browser_sniffer && cd browser_sniffer && bundle install && rake install

Usage

require "browser_sniffer"

client_info = BrowserSniffer.new(request.user_agent)
client_info.form_factor           # => :tablet
client_info.browser               # => :safari
client_info.major_browser_version # => 4
client_info.engine                # => :webkit
client_info.major_engine_version  # => 531
client_info.os                    # => :ios
client_info.os_version            # => 3.2

Contributing

Fork, branch & pull request.

Licensing

Based off UAParser.js

Copyright (c) 2013 Shopify
Copyright (c) 2012-2013 Faisalman fyzlman@gmail.com
Dual licensed under GPLv2 & MIT