# My Android tablet was not detected as a mobile device

**URL:** https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734
**Category:** Support
**Created:** [3월 25, 2015, 2:35오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734 "2015-03-25T02:35:49Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [3월 25, 2015, 2:35오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/1 "2015-03-25T02:35:50Z")

</div>

Hi, I noticed that on my 7" Android tablet, using the stock Android browser and also on mobile Firefox, the portrait version of topics with wide images aren’t scaling correctly, making it necessary to horizontally scroll. Here are a few examples:

- [http://budgetandroidforum.com/t/review-huu-h1001-10-1-tablet](http://budgetandroidforum.com/t/review-huu-h1001-10-1-tablet)
- [http://budgetandroidforum.com/t/review-measy-rc7-2-4ghz-3-in-1-portable-wireless-air-mouse-keyboard-coming-soon](http://budgetandroidforum.com/t/review-measy-rc7-2-4ghz-3-in-1-portable-wireless-air-mouse-keyboard-coming-soon)

Any suggestions? Thanks a lot.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 25, 2015, 4:43오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/2 "2015-03-25T04:43:19Z")

</div>

We only support the native browser, and per our FAQ, only Android 4.1 or greater where Google Chrome is the default, native browser. Can you repro in Chrome?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 25, 2015, 4:57오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/3 "2015-03-25T04:57:34Z")

</div>

Also I checked on my nexus 7 with latest updates and it seems fine in chrome..

 ![](https://global.discourse-cdn.com/meta/original/3X/e/f/ef453b4d7f34a81095fbb182b631b01dce0e2f77.png)

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [3월 25, 2015, 1:09오후 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/4 "2015-03-25T13:09:13Z")

</div>

Thanks @codinghorror for looking into this.

It’s strange, I tried it on Chrome as well, but it definitely does not scale correctly:

 ![](https://global.discourse-cdn.com/meta/original/3X/1/1/110af8ef034ab067e7e8aa2a148040b845cb4357.jpg) 

Notice how the picture of the tablet in the review is chopped off. (Sorry about poor quality literal screenshot, real screenshots don’t work on my tablet and my good camera is broken atm.) By the way, it’s running Android 4.4.2.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 25, 2015, 6:35오후 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/5 "2015-03-25T18:35:22Z")

</div>

I do not think that device is getting mobile layout. Try switching to mobile layout via hamburger menu at upper right.

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [3월 25, 2015, 6:47오후 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/6 "2015-03-25T18:47:13Z")

</div>

–There’s a “Request desktop site” option in Chrome (and in Firefox) but it’s not checked.  
Ah, the Discourse hamburger menu. I’ll be darned, there is an option, and that fixes it.

So now, the question is: Why doesn’t this device get detected as a mobile device?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 25, 2015, 9:55오후 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/7 "2015-03-25T21:55:11Z")

</div>

I think we only detect the Nexus 7, because there are such a wide range of Android tablet devices, it’s unclear what the `User-Agent` would be that can cover all those tablets reliably.

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [3월 26, 2015, 2:59오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/8 "2015-03-26T02:59:23Z")

</div>

Weird, I thought the user agent for mobile browsers was labeled as such. But for my tablet at [whatsmyuseragent.com](http://whatsmyuseragent.com) I’m just seeing “`Mozilla/5.0 (Linux; Android 4.4.2; U25GT-C4WB Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/5.37.36`”. Quite ambiguous.

I’m not a developer, but would it be possible to:

1. Check for the presence of the word “Android” in the user agent and always offer the mobile version if present? It’s a pretty safe bet that most Android users are on a smaller screen.
2. Check the browser window size and offer the mobile version by default below certain parameters. The above mentioned [whatsmyuseragent.com](http://whatsmyuseragent.com) was able to correctly detect my screen resolution and browser window size.

Come to think of it, Discourse does seem to be able to somehow detect what is _ **not** _ a mobile browser, because on my desktop Firefox browser the Discourse hamburger menu does not even give me the option of using the mobile version.

---

<div class="post-metadata">

### Author: ![trident](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trident/32/2078_2.png) [@trident](https://meta.discourse.org/u/trident)
#### Post date: [3월 26, 2015, 3:24오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/9 "2015-03-26T03:24:42Z")

</div>

It looks like the regex listed [here](https://developer.chrome.com/multidevice/user-agent) should be applied [here.](https://github.com/discourse/discourse/blob/17d07a8b9a3db9d963f9d7d5bd73504984ef3188/lib/mobile_detection.rb#L3) Tablet chrome won’t include “Mobile” as a part of the user agent string; causing this check to fail.

(currently, this checks if the useragent contains “Mobile,” “webOS”, “Nexus 7” or does not contain “iPad”)

The ability to toggle mobile mode on and off seems to be determined [here](https://github.com/discourse/discourse/blob/17d07a8b9a3db9d963f9d7d5bd73504984ef3188/app/assets/javascripts/discourse/initializers/sniff-capabilities.js.es6#L20), but I’m not as sure on that one.

I’m not infront of something to test with for a little while, but I believe something like

```ruby
/iphone|ipad|ipod|(Android.*Chrome\/[.0-9]* (!?Mobile))/

```

might cover these cases better.

---

<div class="post-metadata">

### Author: ![sphism](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sphism/32/115807_2.png) [@sphism](https://meta.discourse.org/u/sphism)
#### Post date: [3월 26, 2015, 3:39오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/10 "2015-03-26T03:39:07Z")

</div>

Wouldn’t you want a responsive desktop style to catch all these anyway?

---

<div class="post-metadata">

### Author: ![trident](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trident/32/2078_2.png) [@trident](https://meta.discourse.org/u/trident)
#### Post date: [3월 26, 2015, 3:47오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/12 "2015-03-26T03:47:28Z")

</div>

Seems sensible now; from past discussion it seemed easier to focus on two themes.  
[https://meta.discourse.org/t/responsive-mobile-optimization-vs-device-detection/9831/9](https://meta.discourse.org/t/responsive-mobile-optimization-vs-device-detection/9831/9)

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [3월 26, 2015, 3:58오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/13 "2015-03-26T03:58:57Z")

</div>

Incidentally, it looks like Android KitKat 4.4 doesn’t come with Chrome by default anymore, according to:

> **[Why Chrome not shipping with Android 4.4 might not be a bad thing](https://cloudfour.com/thinks/why-chrome-not-shipping-with-android-4-4-might-not-be-a-bad-thing/)**
>
> Maximiliano Firtman broke the news a couple days ago that Android 4.4 (Kit Kat) will not ship to manufacturers with a browser: I had official confirmation: Android 4.4+ doesn’t ship with any browser, just the WebView. The emulator has it but not real...

My 4.4 tablet comes with a browser that renders the Discourse mobile version just as well as Chrome does once it’s enabled from the hamburger menu. Here’s the user agent:  
`Mozilla/5.0 (Linux; Android 4.4.2; U25GT-C4WB Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36`

---

<div class="post-metadata">

### Author: ![sphism](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sphism/32/115807_2.png) [@sphism](https://meta.discourse.org/u/sphism)
#### Post date: [3월 26, 2015, 5:26오전 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/14 "2015-03-26T05:26:29Z")

</div>

Yeah the current approach seems sensible in that respect. I’ve just spent the last week theming a discourse site and was kinda confused why the mobile theme was totally separate. I ended up pulling in a few parts of the mobile templates to make a narrow desktop breakpoint, but it’s not ideal.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 15, 2016, 11:48오후 UTC](https://meta.discourse.org/t/my-android-tablet-was-not-detected-as-a-mobile-device/26734/15 "2016-03-15T23:48:45Z")

</div>


