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:
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?
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.
–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?
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.
Weird, I thought the user agent for mobile browsers was labeled as such. But for my tablet at 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:
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.
Check the browser window size and offer the mobile version by default below certain parameters. The above mentioned 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.
It looks like the regex listed here should be applied here. 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, 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
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
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.