How can I turn off the zoom function on our website, but for Android phones/devices only (but not affect iPhones)?
It might be fine if I just target the Chrome browser on Android, but also check to confirm the mobile screen size.
How can I turn off the zoom function on our website, but for Android phones/devices only (but not affect iPhones)?
It might be fine if I just target the Chrome browser on Android, but also check to confirm the mobile screen size.
A meta tag you should use to turn zoom function off would be the next:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
You'll find more information reading the answers section of this StackOverflow question
Next thing you've got to do is to find out about user's operating system. The way to do so depends on server's programming language.
Ok, since you're using Ruby, you might need something like
request.user_agent.include?("Android")
to get user's OS. But you've got to know this information is not guaranteed to be sent.
So, combining both elements we've got something like:
<% if request.user_agent.include?("Android") %>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<% end %>
Put this in the head of your html.
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />