{"id":24506,"date":"2011-03-30T00:00:00","date_gmt":"2011-03-30T00:00:00","guid":{"rendered":"https:\/\/alienroad.com\/google-bilgi-bankasi\/mo-better-to-also-detect-mobile-user-agent\/"},"modified":"2011-03-30T00:00:00","modified_gmt":"2011-03-30T00:00:00","slug":"mo-better-to-also-detect-mobile-user-agent","status":"publish","type":"ar_kb","link":"https:\/\/alienroad.com\/google-bilgi-bankasi\/mo-better-to-also-detect-mobile-user-agent\/","title":{"rendered":"Mo&#8217; better to also detect &#8220;mobile&#8221; user-agent"},"content":{"rendered":"<aside class=\"key-point\">It&#8217;s been a while since we published this blog post. Some of the information may be outdated (for example, some images may be missing, and some links may not work anymore).<\/aside>\n<p class=\"gargardate\">Wednesday, March 30, 2011<\/p>\n<p>\n  Here&#8217;s a trending User-Agent detection misstep we hope to help you prevent: While it seems<br \/>\n  completely reasonable to key off the string &#8220;android&#8221; in the User-Agent and then redirect users<br \/>\n  to your mobile version, there&#8217;s a small catch&#8230; Android tablets were just released! Similar to<br \/>\n  mobile, the User-Agent on Android tablets also contains &#8220;android,&#8221; yet tablet users usually prefer<br \/>\n  the full desktop version over the mobile equivalent. If your site matches &#8220;android&#8221; and then<br \/>\n  automatically redirects users, you may be forcing Android tablet users into a sub-optimal<br \/>\n  experience.\n<\/p>\n<p>\n  As a solution for mobile sites, our Android engineers recommend to specifically<br \/>\n  <a href=\"https:\/\/android-developers.blogspot.com\/2010\/12\/android-browser-user-agent-issues.html\" class=\"external-link\">detect &#8220;mobile&#8221; in the User-Agent string<\/a><br \/>\n  as well as &#8220;android.&#8221; Let&#8217;s run through a few examples.\n<\/p>\n<p>With a User-Agent like this:<\/p>\n<div><\/div>\n<p>\n  Since there is no &#8220;mobile&#8221; string, serve this user the desktop version (or a version customized<br \/>\n  for Android large-screen touch devices). The User-Agent tells us they&#8217;re coming from a<br \/>\n  large-screen device, the XOOM tablet.\n<\/p>\n<p>On the other hand, this User-Agent:<\/p>\n<div><\/div>\n<p>\n  Contains &#8220;mobile&#8221; and &#8220;android,&#8221; so serve the web surfer on this Nexus One the mobile experience!\n<\/p>\n<p>You&#8217;ll notice that Android User-Agents have commonalities:<\/p>\n<p><img decoding=\"async\" alt=\"Disambiguation of a typical Android user-agent string\" src=\"https:\/\/alienroad.com\/wp-content\/uploads\/kb-gorsel\/g-92daa02f4af5.jpg\" loading=\"lazy\"><\/p>\n<p>\n  While you may still want to detect &#8220;android&#8221; in the User-Agent to implement Android-specific<br \/>\n  features, such as touch-screen optimizations, our main message is: Should your mobile site depends<br \/>\n  on UA sniffing, please detect the strings &#8220;mobile&#8221; and &#8220;android,&#8221; rather than just &#8220;android,&#8221; in<br \/>\n  the User-Agent. This helps properly serve both your mobile and tablet visitors.\n<\/p>\n<p>\n  For questions, please join our Android community in their<br \/>\n  <a href=\"https:\/\/developer.android.com\/community\/index\" class=\"external-link\">developer forum<\/a>.\n<\/p>\n<p class=\"byline-author\">\n  Written by<br \/>\n  <a href=\"https:\/\/developers.google.com\/search\/blog\/authors\/maile-ohye\" rel=\"author\" class=\"external-link\">Maile Ohye<\/a>,<br \/>\n  Developer Programs Tech Lead<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a while since we published this blog post. Some of the information may be outdated (for example, some images may be missing, and some links may not work anymore). Wednesday, March 30, 2011 Here&#8217;s a trending User-Agent detection misstep we hope to help you prevent: While it seems completely reasonable to key off [&hellip;]<\/p>\n","protected":false},"menu_order":84937,"template":"","meta":{"footnotes":""},"ar_kb_kategori":[665],"ar_kb_etiket":[],"class_list":["post-24506","ar_kb","type-ar_kb","status-publish","has-post-thumbnail","hentry","ar_kb_kategori-blog"],"_links":{"self":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb\/24506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb"}],"about":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/types\/ar_kb"}],"version-history":[{"count":0,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb\/24506\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/media\/26853"}],"wp:attachment":[{"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/media?parent=24506"}],"wp:term":[{"taxonomy":"ar_kb_kategori","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb_kategori?post=24506"},{"taxonomy":"ar_kb_etiket","embeddable":true,"href":"https:\/\/alienroad.com\/wp-json\/wp\/v2\/ar_kb_etiket?post=24506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}