- Progressive Web Application Development by Example
- Chris Love
- 318字
- 2021-08-05 10:33:20
The add to homescreen experience
The emergence of an automatic prompt to a visitor to add your progressive web app to their homescreen is exciting. In the past, Chrome would eventually display a prompt to install a progressive web app, but that has changed recently. The rules determining when the prompt triggers are still valid, but now only trigger the beforeinstallprompt event.
How the user prompt triggers is where each browser can choose a different path. Some of the requirements are defined in the web manifest specification, but the experience is left open ended for browsers to implement as they see fit.
Right now, Chrome has the most mature process. They established the following criteria to automatically trigger the add to homescreen experience:
- Has a web app manifest file with:
- A short_name (used on the homescreen)
- A name (used in the banner)
- A 144 x 144 .png icon (the icon declarations must include a mime type of image/png)
- Astart_url that loads
- Has a service worker registered on your site:
- Has a fetch event handler
- The Fetch event handler cannot be a noop function, it must do something
- Is served over HTTPS (a requirement for using service worker)
- Is visited at least twice, with at least five minutes between visits
- FireFox, Samsung, and Opera have similar requirements. FireFox will trigger the experience on Android, but not the desktop. You can allow the experience on desktop, but it is hidden behind a flag.
These browsers typically provide a simple visual queue in the browser's address bar. Here is how FireFox on Android displays the indicator:

Notice how it uses a house with a + to indicate that the site can be installed. To its right, you will also see an Android logo silhouette. The little Android head indicates that an app is available. In this case, it is detecting the PWA I installed from Chrome, which created a WebAPK.
- RCNP實(shí)驗(yàn)指南:構(gòu)建高級(jí)的路由互聯(lián)網(wǎng)絡(luò)(BARI)
- 物聯(lián)網(wǎng)識(shí)別技術(shù)
- 異構(gòu)基因共表達(dá)網(wǎng)絡(luò)的分析方法
- Hands-On Industrial Internet of Things
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- 城市治理一網(wǎng)統(tǒng)管
- 物聯(lián)網(wǎng)之霧:基于霧計(jì)算的智能硬件快速反應(yīng)與安全控制
- Echo Quick Start Guide
- 網(wǎng)絡(luò)利他行為研究:積極心理學(xué)的視角
- 網(wǎng)絡(luò)空間全球治理觀察
- 云工廠:開啟中國(guó)制造云時(shí)代
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)
- Web用戶查詢?nèi)罩就诰蚺c應(yīng)用
- 數(shù)字王國(guó)里的虛擬人:技術(shù)、商業(yè)與法律解讀
- 想象的互動(dòng):網(wǎng)絡(luò)人際傳播中的印象形成