Skip to content
Properly detect what browser you are dealing with
Ruby
Branch: master
Clone or download
RyanBillard Merge pull request #24 from Shopify/pos-next-webview-tests
add tests for POS Next user agents via embedded webview
Latest commit 7fdbda4 Nov 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Enable CLA bot Oct 19, 2018
lib bump version to 1.1.3 May 3, 2019
test add tests for POS Next user agents via embedded webview Nov 25, 2019
.gitignore Initial commit Jun 19, 2013
.travis.yml Also test on more recent versions of Ruby Sep 19, 2019
Gemfile Initial commit Jun 19, 2013
LICENSE.txt Initial commit Jun 19, 2013
README.md Add travis-ci Jun 19, 2013
Rakefile Initial commit Jun 19, 2013
browser_sniffer.gemspec Update bundler version Mar 25, 2019
init.rb Initial commit Jun 19, 2013
shipit.rubygems.yml Setup shipit fetch hook Aug 5, 2014

README.md

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

You can’t perform that action at this time.