About
There is nothing permanent except change. — Heraclitus.
CanIUse is a Rack middleware for browser compatibility checking inspired from rack-noie. It checks if your user's browser supports the technologies your website relies on by using the caniuse database. It allows you to redirect those who have unsupported browser versions away from your website.
Example
use Rack::BrowserCheck,
redirect: 'http://whatbrowser.org/',
features: [
'webworkers', 'filereader', 'bloburls',
'filesystem', 'websockets', 'fileapi'
]
Installation
Add to your Gemfile.
gem 'rack-caniuse', require: 'rack/caniuse'
Configuration
CanIUse accepts two configuration parameters: redirect
and features
. See the example above.
The first allows you to set the URL to redirect to when users have an unsupported browser version. By default, we will redirect users to www.browsehappy.com (you may want to use more punitive measures as you see fit).
The second accepts an array of features, using the caniuse naming scheme.
License
GPL.