Page MenuHomePhabricator

'Desktop' link requires cookies
Closed, ResolvedPublic

Description

When browsing Wikipedia using Orweb (https://github.com/guardianproject/Orweb), clicking on the 'Desktop' link causes the mobile page to reload - it does not load the desktop site.


Version: unspecified
Severity: enhancement
Whiteboard: gci2013
URL: http://www.google-melange.com/gci/task/view/google/gci2013/6727347264815104

Details

Reference
bz51277

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:51 AM
bzimport set Reference to bz51277.
bzimport added a subscriber: Unknown Object (MLST).

Tentatively moving to MobileFrontend.

I've not used Orweb before but I assume this is related to cookies. A cookie is set to send you to the mobile site. Can you confirm if you are accepting cookies for Wikipedia?

Once I add http://wikipedia.org to the orweb cookie whitelist the Desktop link works.

If the Desktop link requires cookies, and engineering thinks that is acceptable(i dont), it should at least provide information to that effect when clicked without cookies.

So the desktop link will automatically redirect to the mobile site on a mobile device. When the cookie is present it doesn't.

I'm not sure how we could achieve this without cookies... any suggestions?

For a variety of reasons, we settled on using cookies as the best strategy for handling this.

We could potentially make a change to the squid ACLs to prevent the redirect in the event that mobileaction=toggle_view_desktop is present in the query string. If a user had cookies disabled, this would have the effect of toggling you to the desktop as a one-time thing (subsequent requests would probably cause the user to be redirected to the mobile site) - although we'd need to discuss with operations; I'm not sure how they'd feel about it; and I'm not sure how much value this would add considering that what we are discussing is an edge case.

I think what John is suggesting though is that we have some way of notifying users that they must have cookies enabled in order to use the functionality. To me, this may be the most sensible approach, particularly if we only display messaging for users who do not have cookies enabled - though I'm not sure we'd be able to realistically do this on devices that do not support JS.

(In reply to comment #4)

So the desktop link will automatically redirect to the mobile site on a
mobile
device. When the cookie is present it doesn't.

I'm not sure how we could achieve this without cookies... any suggestions?

If the user-agent accesses the desktop site without cookies enabled, can you not redirect them to the mobile site?

Authur, yes, if not possible to work properly without cookies, the user should be informed ( again, this may be technically impossible with currect tech in which case LATER is appropriate but documentation could still be improved)

If the latter, sounds like this needs design? I'm guessing we could detect the case where a user tries to toggle to desktop and lands back on mobile and give them a message saying they need to enable cookies?

Andre / Quim - slightly challenging task and not clear if this is desired, but some kind of patch for the beta mode of the site might be a good task for Google Code in 2013.

A first step would involve:
In beta when I don't have cookies enabled and click 'desktop link', I get an alert saying "Cookies are needed to switch to desktop mode." and remain on the page

(window.alert is the easiest thing to do right now but when we have a proof of concept we can explore how we might inform the user to enable cookies)

If you define the task as in comment 8 then it can be a good GCI task.

It's quite trivial to do this check via JavaScript in the desktopViewClick handler (I just created M.settings.cookiesEnabled which sets a cookie, checks its existence, then deletes if success) and that works fine. But what happens when a user doesn't have JavaScript *or* cookies? How does one alert them then?

It seems like it would require some sort of intermediate special page (e.g. Special:SwitchViewMode or whatever) that would try something like the following:

  • If client has JavaScript enabled:
    • Check using JavaScript if cookies are supported
    • If they are, redirect to the mobileaction url
  • If client does not have JavaScript:
    • Check if cookies are available through serverside methods*
    • If so, redirect to mobileaction url
  • When at any point in this process we realize that cookies are not available, display a message that essentially says "Cookies are required to switch to the desktop site. Please enable them and try again."

Does this sound sane? Any better ideas?

*setting temporary cookie and then reloading + checking if cookie is set, in a simplified nutshell

(In reply to comment #7)

If the latter, sounds like this needs design? I'm guessing we could detect the
case where a user tries to toggle to desktop and lands back on mobile and give
them a message saying they need to enable cookies?

This is simpler, though, so... maybe instead of a JavaScript alert we could just do the check in PHP and output an HTML error box instead? Would that be acceptable?

Sorry for the bugspam.

Now that I've had some sleep, it's probably best to unify the two solutions -- in other words, hijack the link via JavaScript (if JavaScript is enabled) to check for cookies and then redirect. If JS is not available we could either a) just reload the page and do the check for the mobileaction==toggle_view_desktop before every page load and warn them about cookies if necessary, or b) take them to a special page which would check for cookies/display warning if necessary/etc. B is probably more failsafe and would keep us from having to check before every page load, but then again A seems quite a bit easier.

Change 104209 had a related patch set uploaded by M4tx:
Add 'You need cookies' message to 'Switch to desktop' link

https://gerrit.wikimedia.org/r/104209

Change 104210 had a related patch set uploaded by Theopolisme:
Warn user when attempting to switch to desktop without cookies

https://gerrit.wikimedia.org/r/104210

Change 104209 abandoned by M4tx:
Add 'You need cookies' message to 'Switch to desktop' link

https://gerrit.wikimedia.org/r/104209

(In reply to comment #4)

So the desktop link will automatically redirect to the mobile site on a
mobile
device. When the cookie is present it doesn't.

I'm not sure how we could achieve this without cookies... any suggestions?

There are some devices that don't support cookies. I think they should still be supported. How about some query string like you suggest, but it propagates itself to all the other wiki links in the page? So if you visit http://en.wikipedia.org/wiki/Dog?keepmobile=no then all the links on that page that point to en.wikipedia would also have keepmobile=no or whatever query string you want to use.

The user is now informed that cookies are needed to switch modes (When they have JavaScript enabled).

Rewriting all URLS as suggested in comment #c16 is tricky - this would break how caching works across the site.

This is as best as we can fix this problem without a massive overhaul of MediaWiki.

Change 104210 merged by jenkins-bot:
Warn user when attempting to switch modes without cookies

https://gerrit.wikimedia.org/r/104210