Page MenuHomePhabricator

[GOAL] Make desktop and mobile site installable on web browsers as progressive web app (PWA) (add to home screen, web app install prompt)
Open, MediumPublicGoal

Description

The webappmanifest API was added a while back to MobileFrontend to allow installation on mobile devices.

Recently Chrome allows installation of apps on desktop and it's clear from the direction of other browsers that this is becoming less of a mobile-web concept and more of a web concept.

From a marketing perspective, as well as product perspective (potential source of new page views) it is desirable to make the new Vector installable for when the new Modern Vector skin rolls out to all wikis.

Goals

  • I should be able to install the Wikipedia website in browsers which support web app installations.

Technical goals

Web app manifest

  • The required checklist items for the manifest section should be ticked for mobile
  • The manifest file should be referenced for all skins including the desktop site
  • The API should be moved out of MobileFrontend into a more appropriate place. MediaWiki core is proposed given this is useful for all skins.
  • The manifest API should allow customization per skin. It should accept a "skin" parameter.
  • Skins should be able to customize certain values in the manifest using the hooks system. A hook onWebAppManifestGeneration( Skin $skin ) might be appropriate here.
  • The API response should be highly cached. Suggested: 1 week age to allow for updates via the train.

Service worker

  • We will likely need to add a minimal service worker to meet the criteria for Chrome web apps. To begin with our service worker might cache static assets such as the logo.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

could it be a duplicate of T218249 or vice versa?

Jdlrobson renamed this task from [GOAL] Make desktop and mobile site installable on web browsers as progressive web app to [GOAL] Make desktop and mobile site installable on web browsers as progressive web app (add to home screen, web app install prompt).Jun 1 2021, 10:16 PM
Jdlrobson added subscribers: dbarratt, Berot3, Heddy10 and 4 others.
Jdlrobson triaged this task as Medium priority.Jun 2 2021, 6:06 PM
Aklapper renamed this task from [GOAL] Make desktop and mobile site installable on web browsers as progressive web app (add to home screen, web app install prompt) to [GOAL] Make desktop and mobile site installable on web browsers as progressive web app (PWA) (add to home screen, web app install prompt).Jun 3 2021, 11:48 AM
Frostly changed the subtype of this task from "Task" to "Goal".Jun 6 2021, 11:03 PM

I really couldn't wait for that feature ;) The lack of a mobile app for an enterprise MediaWiki is a real drawback, so I took it upon myself to build Extension:PWA.

It also lets site admins define many PWAs per wiki installation (eg: one for finance, one for legal) and they in turn can have their own home pages, service workerks, designs, theme colors, etc.

Safari support is also built in. So are install buttons (but those would not be really meaningful on Wikipedia).

Nice! Thanks for building this! It's cool to have this feature usable without having to install MobileFrontend!
It's also interesting there is an option that you can edit the JSON locally on MediaWiki:default-manifest.json although it would be nice to also define that in LocalSettings.php

I think it makes sense to move the manifest API from MobileFrontend to core, it'll reduce maintenance and benefit other configurations.

As for fulfilling the installability requirements, the service worker does not need to do anything other than setting the event listeners. Here's the sw.js example I used in the Citizen skin, which is enough for the PWA install banner. The implementation is based on MobileFrontend, but I updated the icon getter and a few configs.

@alistair3149 would you be interested on working on this ticket to move the API to core with me reviewing your patches? I am going to be taking a break over Christmas, but would be happy to work with you towards that in January if you feel inclined.

@alistair3149 would you be interested on working on this ticket to move the API to core with me reviewing your patches? I am going to be taking a break over Christmas, but would be happy to work with you towards that in January if you feel inclined.

Glad to if I can be of any help!

Cool I'll circle back in January. Feel free to poke around at the code and Gerrit in the mean time :-)
Also off topic: it would be great if you could join us at https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2023 to talk and build skins (scholarships are available if applicable!)!

Thank you for the invitation! I'll think about it but I'm unsure since I am not as active in WMF projects and it's pretty far.

Back to the main topic, is there any follow-up or useful information that came up with this patch (sorry for the necromancy)? I'm curious on the service worker feedbacks from Google and Mozilla as well, as caching (along with naming things) are not my strong suits :/

Not really any useful information but I personally wouldn't be comfortable with adding the service worker without input from the performance team and Krinkle. I'd suggest the initial focus should be on making the web app manifest usable in core so it works without MobileFrontend. Once we've got some momentum there I can check in with performance team about whether this is something they are interested in.

Change 881002 had a related patch set uploaded (by Alistair3149; author: Alistair3149):

[mediawiki/core@master] Add basic Webapp Manifest API support

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

@alistair3149, thanks for the patch. Will there be a way to disable the default PWA behavior ?

Extension:PWA provides the capacity to define multiple PWAs per MediaWiki installation and will soon get offline browsing capacity. I understand that is not most people's use case for a PWA, but offering a disable switch for those wanting to implement their own would be essential.

@alistair3149, thanks for the patch. Will there be a way to disable the default PWA behavior ?

As I am not sure how it will be implemented at the end, so I don't have an answer for it.

The patch is largely a WIP at the moment as it hasn't fulfill all the requirements above yet, and it only defines the API used to generate the manifest, not how it is being implemented on pages.

The API can expand to allow other extensions or skins to modify its properties with a hook, but I don't know the security or performance implications behind it. As for offline browsing, that is related to service worker and I suppose it can be approached the same way.

@Jdlrobson I have some questions regarding the implementation:

  1. What PWA properties are safe for extensions and skins to modify?
  2. How would the manifest be loaded onto the page?
  3. How would the service worker be loaded onto the page?