Mondays start with merging pull requests by Dependabot.
I’m done with the naturalization interview, so I think I should start practicing English conversations now.
I’ve been listening to “golden hour” by JVKE. I want to die in that atmosphere.
I’m too productive today. I wonder what will happen to my body tomorrow.
Progressive Web App (PWA) is specific type of web applications that are built with standard web technologies such as HTML, CSS, and JavaScript, but it can be installed on a device and behaves like a native mobile application.
According to the article, the requirements of a Progressive Web App are:
- Originate from a Secure Origin. Served over TLS and green padlock displays (no active mixed content).
- Load while offline (even if only a custom offline page). By implication, this means that Progressive Web Apps require Serice Workers.
- Reference a Web App Manifest with at least the following properties:
name
,short_name
,star_url
,display
with a value ofstandalone
orfullscreen
…
With the requirements met, browsers that support PWA can install the application to devices.
According to these resources (please don’t blame me for referring a Wikipedia page), Chromium-based browsers support PWA, but other browsers do not support in many cases.
One of the PWA’s benefits is its closs-platform nature that reduces developers’ burdens. Another key feature is PWA can process real-time notifications thanks to service workers (TODO: Check how it works, Service Worker API - Web APIs | MDN).
A progressive web app must have manifest.json
to let
browsers install it, though its use case is not limited to PWA.
manifest.json
is used to guide browsers on how PWA
should be displayed or behave.
Since Mastodon can be run as a Progressive Web App, we can take a look at mine ocalaavenue.net/manifest.json
{
"id": "/home",
"name": "Ocala Ave",
"short_name": "Ocala Ave",
"icons": [
...(omitted)...
{
"src": "https://ocalaavenue.net/packs/media/icons/android-chrome-192x192-eddc1ed540e97b926202b7b857989d60.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any maskable"
},
...(omitted)...
{
"src": "https://ocalaavenue.net/packs/media/icons/android-chrome-512x512-ccb53c9fcbb5f61bf741cc54998318f0.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
}
],
"theme_color": "#191b22",
"background_color": "#191b22",
"display": "standalone",
"start_url": "/",
"scope": "/",
"share_target": {
"url_template": "share?title={title}&text={text}&url={url}",
"action": "share",
"method": "GET",
"enctype": "application/x-www-form-urlencoded",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
"shortcuts": [
{
"name": "Compose new post",
"url": "/publish"
},
{
"name": "Notifications",
"url": "/notifications"
},
{
"name": "Explore",
"url": "/explore"
}
]
}
Top level keys are called members, and according to MDN, these are the required fields for PWAs.
name
orshortname
icons
must contain a 192px and a 512 px iconstart_url
display
and/ordisplay_override
prefer_related_applications
must befalse
or not present
You can see that the Mastodon’s manifest.json
meets the
requirements.
Wow, I didn’t know that I could install a web application like a native application. (How many people are aware of this?)
TODO: