漸進式web應用程序_如何在漸進式Web應用程序中添加到主屏幕

漸進式web應用程序

添加到主屏幕 (Add To Homescreen)

Here the web app install banner is focused on web app, with the feature of add to homescreen.

在此,Web應用程序安裝標語專注于Web應用程序,具有添加到主屏幕的功能。

瀏覽器對“添加到主屏幕”的支持 (Browser Support for Add To Homescreen)

Add to Homescreen functionality is currently supported by:

當前受“添加到主屏幕”功能的支持:

  • Chrome

    Chrome
  • iOS Safari

    iOS Safari

You can see the latest status of browser support of this feature here.

您可以在此處查看該功能的瀏覽器支持的最新狀態。

在Android上 (On Android)

On Android, the “add to homescreen” banner comes up automatically if you meet certain requirements. This is what it should look like on Android:

在Android上,如果您滿足某些要求,則會自動顯示“添加到主屏幕”橫幅。 這是在Android上的外觀:

Add to homescreen promptWhen app launched

添加到主屏幕提示應用啟動時

要求 (Requirements)

include a manifest.json file with the following properties:

包含具有以下屬性的manifest.json文件:

  • short name

    short name

  • name

    name

  • 192x192 size of png icon

    192x192大小的png圖標

  • start_url

    start_url

  • include a service worker that is both registered and activated

    包括已注冊和激活的服務人員
  • the website served over HTTPS (you can still try this with localhost without HTTPS)

    該網站通過HTTPS提供服務(您仍然可以在沒有HTTPS的情況下使用localhost嘗試此操作)
  • the website meets engagement heuristics defined by Chrome

    該網站符合Chrome定義的互動啟發法

manifest.json (manifest.json)

{"name": "FreeCodeCamp","short_name": "FreeCodeCamp","theme_color": "#00FF00","background_color": "#00FF00","display": "standalone","Scope": "/","start_url": "/","icons": [{"src": "assets/images/icons/icon-72x72.png","sizes": "72x72","type": "image/png"},{"src": "assets/images/icons/icon-96x96.png","sizes": "96x96","type": "image/png"},{"src": "assets/images/icons/icon-128x128.png","sizes": "128x128","type": "image/png"},{"src": "assets/images/icons/icon-144x144.png","sizes": "144x144","type": "image/png"},{"src": "assets/images/icons/icon-152x152.png","sizes": "152x152","type": "image/png"},{"src": "assets/images/icons/icon-192x192.png","sizes": "192x192","type": "image/png"},{"src": "assets/images/icons/icon-384x384.png","sizes": "384x384","type": "image/png"},{"src": "assets/images/icons/icon-512x512.png","sizes": "512x512","type": "image/png"}],"splash_pages": null
}
  • name is the name of the web app. (It will be shown in the launch screen)

    name是網絡應用程序的名稱。 (它將顯示在啟動屏幕中)

  • short name is the short name of the web app. (It will be shown below the icon of phone menu)

    short name是Web應用程序的簡稱。 (它將顯示在電話菜單圖標下方)

  • theme_color is the color of the top of the browser.

    theme_color是瀏覽器頂部的顏色。

  • background_color is the background color of the launch screen.

    background_color是啟動屏幕的背景色。

  • display is the way the web app should display once launched on the phone.

    display是網絡應用在手機上啟動后應顯示的方式。

  • start_url define the starting url of the website.

    start_url定義網站的起始URL。

  • icons is an array that store all the images location, sizes and type.

    icons是一個數組,用于存儲所有圖像的位置,大小和類型。

在其他設備上 (On other devices)

Although this method does not work on iOS and Windows, there is a fallback method.

盡管此方法在iOS和Windows上不起作用,但是有一個備用方法。

的iOS (iOS)

On iOS, the “add to homescreen” button must be added manually. Add the following meta tags to the head section of your HTML to support iOS web app icon.

在iOS上,必須手動添加“添加到主屏幕”按鈕。 將以下元標記添加到HTML的頭部,以支持iOS Web應用程序圖標。

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="green">
<meta name="apple-mobile-web-app-title" content="FreeCodeCamp">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-72x72.png" sizes="72x72">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-96x96.png" sizes="96x96">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-128x128.png" sizes="128x128">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-144x144.png" sizes="144x144">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-152x152.png" sizes="152x152">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-192x192.png" sizes="192x192">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-384x384.png" sizes="384x384">
<link rel="apple-touch-icon" href="/assets/images/icons/icon-512x512.png" sizes="512x512">

視窗 (Windows)

On windows phone, add the following meta tags to the head section of your HTML:

在Windows Phone上,將以下元標記添加到HTML的頭部:

<meta name="msapplication-TileImage" content="/assets/images/icons/icon-144x144.png">
<meta name="msapplication-TileColor" content="green">

翻譯自: https://www.freecodecamp.org/news/how-to-add-to-homescreen-in-a-progressive-web-app/

漸進式web應用程序

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390704.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390704.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390704.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

linux shell 編程

shell的作用 shell是用戶和系統內核之間的接口程序shell是命令解釋器 shell程序 Shell程序的特點及用途&#xff1a; shell程序可以認為是將shell命令按照控制結構組織到一個文本文件中&#xff0c;批量的交給shell去執行 不同的shell解釋器使用不同的shell命令語法 shell…

Leetcode之javascript解題(No33-34)

附上我的github倉庫&#xff0c;會不斷更新leetcode解題答案&#xff0c;提供一個思路&#xff0c;大家共勉 在我的主頁和github上可以看到更多的關于leetcode的解題報告&#xff01;&#xff08;因為不知道為什么掘金沒有將其發布出來&#xff0c;目前已經聯系掘金客服&#x…

真實感人故事_您的數據可以告訴您真實故事嗎?

真實感人故事Many are passionate about Data Analytics. Many love matplotlib and Seaborn. Many enjoy designing and working on Classifiers. We are quick to grab a data set and launch Jupyter Notebook, import pandas and NumPy and get to work. But wait a minute…

轉:防止跨站攻擊,安全過濾

轉&#xff1a;http://blog.csdn.net/zpf0918/article/details/43952511 Spring MVC防御CSRF、XSS和SQL注入攻擊 本文說一下SpringMVC如何防御CSRF(Cross-site request forgery跨站請求偽造)和XSS(Cross site script跨站腳本攻擊)。 說說CSRF 對CSRF來說&#xff0c;其實Spring…

Linux c編程

c語言標準 ANSI CPOSIX&#xff08;提高UNIX程序可移植性&#xff09;SVID&#xff08;POSIX的擴展超集&#xff09;XPG&#xff08;X/Open可移植性指南&#xff09;GNU C&#xff08;唯一能編譯Linux內核的編譯器&#xff09; gcc 簡介 名稱&#xff1a; GNU project C an…

html怎么注釋掉代碼_HTML注釋:如何注釋掉您HTML代碼

html怎么注釋掉代碼HTML中的注釋 (Comments in HTML) The comment tag is an element used to leave notes, mostly related to the project or the website. This tag is frequently used to explain something in the code or leave some recommendations about the project.…

k均值算法 二分k均值算法_使用K均值對加勒比珊瑚礁進行分類

k均值算法 二分k均值算法Have you ever seen a Caribbean reef? Well if you haven’t, prepare yourself.您見過加勒比礁嗎&#xff1f; 好吧&#xff0c;如果沒有&#xff0c;請做好準備。 Today, we will be answering a question that, at face value, appears quite sim…

您好,這是我的第一篇文章

您好我是CYL 這是一個辣雞博客 歡迎指教 轉載于:https://www.cnblogs.com/pigba/p/8823472.html

08_MySQL DQL_SQL99標準中的多表查詢(內連接)

# sql99語法/*語法&#xff1a; select 查詢列表 from 表1 別名 【連接類型】 join 表2 別名 on 連接條件 【where 篩選條件】 【group by 分組】 【having 分組后篩選】 【order by 排序列表】分類內連接&#xff08;重點&#xff09;&#xff1a; inner外連接 左外&#xff0…

java中抽象類繼承抽象類_Java中的抽象類用示例解釋

java中抽象類繼承抽象類Abstract classes are classes declared with abstract. They can be subclassed or extended, but cannot be instantiated. You can think of them as a class version of interfaces, or as an interface with actual code attached to the methods.抽…

新建VUX項目

使用Vue-cli安裝Vux2 特別注意配置vux-loader。來自為知筆記(Wiz)

衡量試卷難度信度_我們可以通過數字來衡量語言難度嗎?

衡量試卷難度信度Without a doubt, the world is “growing smaller” in terms of our access to people and content from other countries and cultures. Even the COVID-19 pandemic, which has curtailed international travel, has led to increasing virtual interactio…

Linux 題目總結

守護進程的工作就是打開一個端口&#xff0c;并且等待&#xff08;Listen&#xff09;進入連接。 如果客戶端發起一個連接請求&#xff0c;守護進程就創建&#xff08;Fork&#xff09;一個子進程響應這個連接&#xff0c;而主進程繼續監聽其他的服務請求。 xinetd能夠同時監聽…

《精通Spring4.X企業應用開發實戰》讀后感第二章

一、配置Maven\tomcat https://www.cnblogs.com/Miracle-Maker/articles/6476687.html https://www.cnblogs.com/Knowledge-has-no-limit/p/7240585.html 二、創建數據庫表 DROP DATABASE IF EXISTS sampledb; CREATE DATABASE sampledb DEFAULT CHARACTER SET utf8; USE sampl…

換了電腦如何使用hexo繼續寫博客

前言 我們知道&#xff0c;使用 Githubhexo 搭建一個個人博客確實需要花不少時間的&#xff0c;我們搭好博客后使用的挺好&#xff0c;但是如果我們有一天電腦突然壞了&#xff0c;或者換了系統&#xff0c;那么我們怎么使用 hexo 再發布文章到個人博客呢&#xff1f; 如果我們…

leetcode 525. 連續數組

給定一個二進制數組 nums , 找到含有相同數量的 0 和 1 的最長連續子數組&#xff0c;并返回該子數組的長度。 示例 1: 輸入: nums [0,1] 輸出: 2 說明: [0, 1] 是具有相同數量 0 和 1 的最長連續子數組。 示例 2: 輸入: nums [0,1,0] 輸出: 2 說明: [0, 1] (或 [1, 0]) 是…

實踐作業2:黑盒測試實踐(小組作業)每日任務記錄1

會議時間&#xff1a;2017年11月24日20:00 – 20:30 會議地點&#xff1a;在線討論 主 持 人&#xff1a;王晨懿 參會人員&#xff1a;王晨懿、余晨晨、鄭錦波、楊瀟、侯歡、汪元 記 錄 人&#xff1a;楊瀟 會議議題&#xff1a;軟件測試課程作業-黑盒測試實踐的啟動計劃 會議內…

視圖可視化 后臺_如何在單視圖中可視化復雜的多層主題

視圖可視化 后臺Sometimes a dataset can tell many stories. Trying to show them all in a single visualization is great, but can be too much of a good thing. How do you avoid information overload without oversimplification?有時數據集可以講述許多故事。 試圖在…

iam身份驗證以及訪問控制_如何將受限訪問IAM用戶添加到EKS群集

iam身份驗證以及訪問控制介紹 (Introduction) Elastic Kubernetes Service (EKS) is the fully managed Kubernetes service from AWS. It is deeply integrated with many AWS services, such as AWS Identity and Access Management (IAM) (for authentication to the cluste…

一步一步構建自己的管理系統①

2019獨角獸企業重金招聘Python工程師標準>>> 系統肯定要先選一個基礎框架。 還算比較熟悉Spring. 就選Spring boot postgres mybatis. 前端用Angular. 開始搭開發環境&#xff0c;開在window上整的。 到時候再放到服務器上。 自己也去整了個小服務器&#xff0c;…