7

Stack Exchange sites do offer a “Mobile” link on the footer; after activating it, that particular domain continues to serve its mobile theme for a few weeks (haven't counted exactly).

But the site eventually switches back to desktop mode automatically; at least on desktop browsers.

Is there a way to prevent this revert-switching and stay in mobile theme forever – perhaps by tuning an account-level setting, tweaking some cookie, etc?

0
6

It is governed by a cookie called theme, but it is valid for ... you guessed it ... 6-8 weeks. I just did some experiments and noticed the cookie is valid until January 16th next year. Perhaps they could extend that for a bit longer?

Anyway, the mobile view is meant for mobile browsers, so I doubt they'll build something to remember your preference on your user account (which would make it permanent and cross-device). Everything indicates the company wants to get rid of the mobile view once all pages have a responsive design.

Here's how a site looks like with theme=0:

enter image description here

And this is after switching to the mobile version, now theme=2:

enter image description here

If I delete that cookie, I get the full site back.

14
  • 1
    Sorry, this answer is wrong. It is not using a cookie. I changed now to mobile view here on MSE, opened the site in other device (my phone) and got the mobile view there as well. It's attached to our account via Redis server side cache. (which unlike ordinary cache never expires.) – Shadow Wizard is Vaccinating Dec 5 '20 at 7:24
  • 1
    Then they changed it not too long ago. It definitely used to be one. – Glorfindel Dec 5 '20 at 7:26
  • I remember this behavior for long time, but can't be sure. Worth posting on meta asking about it... ;) – Shadow Wizard is Vaccinating Dec 5 '20 at 7:27
  • @Shadow10YearsWizard I just tested it again and I'm pretty convinced it's the cookie. Perhaps you have a system where your devices share cookies? – Glorfindel Dec 5 '20 at 7:42
  • How exactly did you test? I use Chrome both on PC and mobile, synched with my gmail, didn't know they share cookies. But the term "cookie" refer to device-based data, so if by some dark magic is shared between devices, it's not really a cookie anymore. No? :-) – Shadow Wizard is Vaccinating Dec 5 '20 at 7:42
  • 2
    1. Go to site home page. 2. Switch to mobile view 3. Delete theme cookie 4. Reload page. (All in the same browser, but I tested your 'synchronizing' as well (between Firefox and Safari) and wasn't able to reproduce it.) – Glorfindel Dec 5 '20 at 7:46
  • Hmm.. OK then, thanks! – Shadow Wizard is Vaccinating Dec 5 '20 at 7:48
  • You're welcome, thanks for inspiring me to analyze a bit more and give a thorough answer :) – Glorfindel Dec 5 '20 at 7:49
  • 2
    I wonder what theme=1 will do... – Luuklag Dec 5 '20 at 8:51
  • I am using the desktop view on desktop, and the mobile view on mobile, and the system has no trouble distinguishing which is which. (Also, contrary to both the qustion and the answer here, the setting does appear permanent.) – Emil Jeřábek Dec 5 '20 at 8:51
  • 1
    It is worth mentioning that the theme cookie is http only. You can't set it with javascript and then magically get a mobile view in return. You need to post to /mobile/on and that expects an valid fkey. – rene Dec 5 '20 at 9:04
  • 1
    @EmilJeřábek that is interesting. I tried a few things but the theme cookie expiration date didn't seem to slide, at least not in the actions I took. Once its experiation date passed it got, as expected, removed and didn't return. Can you check the expiration date on your theme cookie and tell us how far it is set in the future? – rene Dec 5 '20 at 10:03
  • @rene I’m sorry, but I haven’t got the slightest idea how to do that. The only cookie-related options I found in the browser menu (which is Chrome on Android) are to delete them, or to disable them. I do not know how to view them or how to check expiration dates. – Emil Jeřábek Dec 5 '20 at 10:28
  • Good research indeed, you two! :) Will try fiddling with the cookie to get the theme to extend for longer... Btw "Everything indicates the company wants to get rid of the mobile view" - hopefully not before the next apocalypse 🙏 – Janaka Bandara Dec 5 '20 at 14:46
4

The mobile theme is still the default for mobile. So, you should be able to always get the mobile view by having your browser claim to be a mobile browser. You will need an extension to do this, so look for a “user agent changer”. Google makes one for Chrome that looks like it would work for you.

(In fact, I am in the opposite situation, using a mobile device but preferring the responsive desktop site. I use iOS Safari which has the ability to always request a desktop version for specific domains, which seems to be done by changing the user agent.)

1
  • Thanks for the tip! In fact I'm using a user-agent override script on mine (FF Nightly) as well - have been using Mobile Safari for quite some time but recently switched to Firefox. Will switch SO domains to use Mobile Safari or some other mobile UA again, and see if it improves the situation 👍 – Janaka Bandara Dec 5 '20 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .