2
I’m doing a browser validation (IE < 10) through the Application Controller with the gem "browser"
. I need any application page that is accessed to run a Javascript function with a message saying that the browser is not recommended.
Any idea, suggestion or other way to do it dynamically?
Code:
class ApplicationController < ActionController::Base
before_action :is_ie_browser?
def is_ie_browser?
if browser.ie? && browser.version.to_i < 10
#executar uma funcao
end
end
end
Blz @Alextakitani, thank you! I had already gone through this solution, but I wanted something more automatic, I have several layouts and some have js files that others do not have. In that case I would have to go through all of them and add the file with Function. I am also not using application.js in some layouts
– Jefferson Alison
Jefferson, you should use the application in all layouts. Taking out you lose the advantages of the pipeline Asset.
– Alex Takitani
Agree @Alextakitani, but in some layouts was generating some conflicts.
– Jefferson Alison