Redirecting smart and dumb mobile browsers in Interface ERB templates
-—————————————————————————————————
In the page you’d like to redirect (or _header.html.erb) -
<%= mobile_redirect(‘http://www.google.com’, ‘http://www.microsoft.com’) %>
The first argument is the address for smart mobile devices defined in the smart_list array (see mobile_redirect method).
The second argument is the address for dumb mobile devices.
If you’d prefer not to redirect a smart or dumb mobile device, pass an empty string:
<%= mobile_redirect(‘http://www.google.com’, ’’) %>
Include this in client_helper.rb:
def mobile_redirect(smart_url, mobile_url)
agent = request.user_agent.downcase