Persisting desktop/mobile view in mobile Chrome browsers

(Michael Downey) #1

I have both an Android phone & tablet, running the latest releases of Android/Chrome.

On the Pixel C, my standard orientation is landscape with a keyboard, so the mobile UI is not ideal. I keep trying the “request desktop version” in the browser options, but really wish that I didn’t have to do this step every single time I load a Discourse site.

Is there any way to persist the mobile/desktop preferences based on a cookie or something?

(Jeff Atwood) #2

Yes, but that cookie would be per domain so how would it help? The real issue is, freakishly rare android tablet, does it send a unique agent like the Nexus series do?

(Michael Downey) #3

I guess it would help by keeping the desktop UI setting every time I went to in my Android Chrome browser. Isn’t that desirable?

And, yes, unique user agent indeed:

Mozilla/5.0 (Linux; Android 6.0.1; Pixel C Build/MXC14G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 Safari/537.36

(Sam Saffron) #4

I think the call here is to always ask for Mobile + Android for Android mobile detection, if we need to whitelist some more 7’’ tablets (so they are treated as mobile) then we can

(Dean Taylor) #5

There are some specific Google Chrome user agent detection recommendations for “Phone” vs “Tablet” listed here:

  • Phone pattern: Android + Chrome/[.0-9]* Mobile
  • Tablet pattern: Android + Chrome/[.0-9]* (?!Mobile)

Android copy/paste menu covers quote reply button
(Jeff Atwood) #6

All right, I’m changing it to

user_agent =~ /Mobile/ && !(user_agent =~ /iPad/)

No idea why we had webOS in there, who even uses that? Let’s just say it’s a mobile device if it is telling us it is one:


(Jeff Atwood) #7

This topic was automatically closed after 2 days. New replies are no longer allowed.