Page MenuHomePhabricator

Add the print button to mobile browsers other than Chrome
Open, LowPublic

Description

With Proton deployed, we will be able to offer browsers other than Chrome the option to download PDFs of articles. Rather than triggering window.print when clicked, the new button will trigger a download of the PDF

Precursors

T179915 will tell us what kind of traffic we can handle. Should be considered a blocker before beginning work on this.

Developer notes for design

  • When clicking the icon we probably want to give some feedback to the user as otherwise, it's possible the user may start multiple downloads through multiple clicks. Please think about treatment here. Options include an intermediate screen that explains the feature (e.g. drawer) or a toast (that says download has started)
  • Do we want to keep the existing behaviour for Chrome - e.g. trigger print? This has repercussions on whether we work on T162414
  • Do we want to continue using the page actions menu icon, or do we want to relocate the icon to another place e.g. bottom of screen/fixed footer menu. We should consider usage compared to features such as language/watch/edit.

Acceptance criteria

  • Remove all restrictions to the code and show the button on all browsers. Make sure getChromeVersion and getAndroidVersion functions have been removed as these no longer do anything (Chrome < 41 and Android < 5 no longer get JS from us).
  • If window.print === undefined trigger the fallback PDF generation
  • try and catch window.print. If an exception is thrown trigger the fallback PDF generation

QA

Confirm that download button shows in Firefox.

Event Timeline

Jdlrobson updated the task description. (Show Details)

Over to you @alexhollender - added some notes. Prioritise as necessary!

Prioritise as necessary!

Understanding that:

  • The deployment of the Proton service is blocked for at least the next week and probably for the next two weeks; and
  • Page Issues is the current top priority.

There are mocks and an Invision-mabob in the description of T163472: [EPIC] Provide a way to download articles in PDF on the mobile website. AIUI that task is out of date and probably needs a pass from both @ovasileva and @alexhollender once they've synced.

Agreed. @alexhollender - if you do get a chance to look this week, for the latest version we decided not to include the file size. So flow should roughly be button click -> spinner -> done. I'll add more notes when I'm back.

I like the idea of having a confirmation step here. Perhaps we could limit it to the first 5 downloads or something?

en.m.wikipedia.org_wiki_Jake_Grey.png (1×800 px, 136 KB)

In terms of telling them "your download has started", or showing the status of the download, I think we should rely on the browser to take care of that.

Before moving forward with any design I think we need to play around in staging a bit to see how various browsers/devices react to the download action. I can think of at least three browser reactions:

  1. download begins immediately. Browser will give some indication that download started
    • this is currently what happens in Chrome/Android if you click a link that leads to a PDF file
  2. user is prompted to choose a location to save the download (in which case it will be obvious to them what's happening)
    • this is what happens if you use the Print > Save to PDF flow in Chrome/Android, or do the Save PDF > Save to My Files flow in Safari/iOS
  3. PDF file opens in a new browser window, unclear to user whether or not it has been "downloaded" to the phone (i.e. can they quit the browser, go offline, and still access the PDF somewhere?)
    • this is what happens in Chrome & Safari on iOS when you click a link that leads to a PDF file

Moving this to blocked until we have the eng resources to add the button on staging so we can play around with a few different browsers/devices

There is also an opportunity here to promote the share API where available to directly wire this to other apps/send functionality: https://www.youtube.com/watch?v=eY9uLyzIKCE&feature=youtu.be

The Share API in an interesting feature to consider. It looks like it only has Android Chrome support, but it's a widely understood feature of mobile apps, and the native Android and iOS Wikipedia apps have it as well.

The only question I have would we, do we link to the mobile page, or the pdf from the share screen?

ovasileva removed a project: Proton.

@Jdlrobson - is this blocked on anything browser wise or is it simply a matter of putting it on staging and testing?

I think we just need to make the button link to the PDF e.g. https://en.wikipedia.org/api/rest_v1/page/pdf/Spain ?

This is only blocked on design (for instance we may want to confirm the download and use a drawer to avoid accidental PDF generation)

It's possible to add the print button to Firefox now thanks to https://bugzilla.mozilla.org/show_bug.cgi?id=1414935 - although note older Firefox browsers with no update path would show a non-functional button.

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

ovasileva lowered the priority of this task from High to Low.May 3 2021, 7:19 PM
Jdlrobson updated the task description. (Show Details)

Mozilla reached out to us about this bug https://github.com/webcompat/web-bugs/issues/80978
Probably worth prioritizing from a technical point of view if not a product point of view as it's easier to test our site when it appears consistently across browsers.