[PWA] ADD Web App to your Home screen

Source: Internet
Author: User

Clone:link

Modify The structure:

Move css, JS, image, index.html to an ' app ' folder.

Manifest.json:

{  "name":"Fireworks App",  "Short_name":"Fireworks",  "icons": [    {    "src":"Images/fireworks-icon192x192.png",    "Sizes":"192x192",    "type":"Image/png"  }],  "Start_url":"/index.html",  "Display":"Standalone",  "Background_color":"#000",  "Theme_color":"#536878"}

Name:showing on splash screen.

Short_name:showing on the Home screen.

Background_color:splash Screen background color

Theme_color:toolbar Color (url bar color)

Icons:icons for display on home screens and splash screen

"Display": "standalone" or "fullscreen"

Start_url:index.html

Add to index.html:

  <Head>    <MetaCharSet= "Uft-8" />    <Metaname= "Theme-color"content= "#536878" />    <Metaname=viewportcontent= "Width=device-width, initial-scale=1">    <title>fireworks!</title>    <Linkhref= "Css/fireworks.css"rel= "stylesheet">    <Linkrel= "manifest"href= "Manifest.json">  <!--Add to home screens for Safari on IOS -  <Metaname= "Apple-mobile-web-app-capable"content= "Yes">  <Metaname= "Apple-mobile-web-app-status-bar-style"content= "BLACK">  <Metaname= "Apple-mobile-web-app-title"content= "Fireworks">  <Linkrel= "Apple-touch-icon"href= "Images/fireworks-icon192x192.png">  <!--Add to home screens for Windows -  <Metaname= "Msapplication-tileimage"content= "Images/fireworks-icon192x192.png">  <Metaname= "Msapplication-tilecolor"content= "#2F3BA2">  </Head>

Register Service Worker:

<Script>  if ('Serviceworker' inchNavigator) {Console.log ("Would the service worker register?"); Navigator.serviceWorker.register ('Service-worker.js'). Then (function(reg) {Console.log ("Yes, it did."); }).Catch(function(Err) {Console.log ("No it didn ' t. This happened:", Err)}); }</Script>

Also Create a service-worker.js in App folder.

Last you can deply to Firebase to see your app

[PWA] ADD Web App to your Home screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.