We can use browsernizer gem to restrict an application to open on old version of browsers or we can notify user to upgrade browser.
Add gem to Gemfile
gem 'browsernizer'
Run
bundel install
rails generate browsernizer:install
This will be create a file as named browsernizer.rb at Path: config/initializers, i.e
Rails.application.config.middleware.use Browsernizer::Router do |config|
config.supported "Internet Explorer", "10"
config.supported "Firefox", "40"
config.supported "Opera", "11.1"
config.supported "Chrome", "45"
config.location "/browser.html"
config.exclude %r{^/assets}
end
Its works like a middleware in application. If the browser version is less than config it will be redirected to /browser.html page that is IE 10+, Firefox 40+, Opera 11.1+ and Chrome 45+ are supported and Non listed browsers are considered to be supported regardless of their version.
0 Comment(s)