0.04
No release in over 3 years
Low commit activity in last 3 years
BrowserWarrior is a Ruby on Rails engine that let you reject your non-modern browser user just one line code
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0, < 5
>= 5.0, < 7
 Project Readme

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.

Note: Ruby on Rails 6.x is supported as well.

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

And then:

$ bundle install

That's it.

All non-modern browser 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.11.0, support Ruby on Rails 6.x
  • Release 0.1.0, one line code to support rejecting old browser page
  • I18n support ( 0.3.0 )

Contributing

License

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