發表於 程式分享

PWAs(Progressive Web Apps)學習筆記之2: manifest.json

一、manifest.json設定

1.假設manifest.json放在與web application的根目錄下,同index.html

2.index.html內設定

<link rel="manifest" href="/manifest.json">

二、mainfest.json properties介紹

1.name: Web App名稱

2.short_name: Web App短名稱

3.start_url: 設定起始連結

4.scope: 相關設定影響範圍

5.display: 顯示模式,包含fullscreen、standalone、minimal-ui、browser

6.background_color: 背景顏色,如#FFDDEE

7.theme_color: 主題顏色,如#AABBCC

8.description: Web App描述

9.dir: 排版方式,ltr(由左到右)、rtl(由右到左)、auto(自動)

10.lang: Web App語系,如en-US

11.orientation: 螢幕方向ㄝany、natural、landscape、portrait、portrait-primary、portrait-secondary、landscape-primary、landscape-secondary

12.icons: 應用程式圖示,為一array,有src、type、sizes等properties

1) src: Ex../assets/images/android_144.png

2) sizes: Ex.144×144

3) type: Ex.image/png

13.related_applications: 推薦原生app的連結,為一array,有platform、url、id等properties

1) platform: 可以找到該應用程式的平台,Ex.play

2) url: 可以找到該應用程式的網址,Ex.https://play.google.com/store/apps/details?id=cheeaun.hackerweb

3) id: 在特定平台上代表該應用程式的 ID,Ex.com.example.app1

14.prefer_related_applications: 是否要推薦一個原生的app,true或false

發表留言