A Rails gem that rejects non-modern browsers with only one line code
Ruby HTML CSS JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
img
lib
test
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
browser_warrior.gemspec

README.md

BrowserWarrior

Are you a warrior? Are you brave enough to reject your non-modern browser users?

It is time to say YES.

BrowserWarrior makes this super easy with one line of code.

Note: Only Ruby on Rails 5.x is supported at this time.

# in your Gemfile
gem 'browser_warrior', '~> 0.10.0'

And then:

$ bundle install

That's it.

All IE 6/7/8 users will be redirected to a page that suggests they should upgrade their browsers.

Upgrading browser screenshot (en) screenshot

Upgrading browser screenshot (zh-CN) screenshot

Configuration

Question: Can I add more unsupported browsers?

Very easy. Run:

$ rails g browser_warrior:install

It will generate browser_warrior.rb in config/initializers/.

There is a browser object that you can easily customize.

See more: https://github.com/fnando/browser#usage

Question: Can I customize the suggested browser page?

Sure. Run:

$ rails g browser_warrior:views

It will generate view and css files for you that can be edited.

Nice and easy.

i18n

BrowserWarrior will render the correct page based on your i18n locale config. It currently supports en and zh-CN, and you can add more locale pages easily.

Advice

I suggest adding the code below to your base layout( e.g. application.html.erb ):

// app/layouts/application.html.erb
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />

Roadmap

  • Release 0.1.0, one line code to support rejecting old browser page
  • I18n support ( 0.3.0 )
  • Extend support to rails 4 and rails 3.
  • Extend support to more than one theme.

Contributing

License

The gem is available as open source under the terms of the MIT License.