Objective
The benefits of PWA as a new web-side technology for Google are self-evident, but there is not a lot of knowledge about the relevant aspects here, and here I come up with a series of introductory tutorials in this area that provide learning in PWA.
What is PWA
The PWA full name Progressive web app, a progressive web app, was introduced in 2015 by Google and was only promoted in June 2016. is a combination of a range of modern web technologies that enable a user experience that is similar to native applications in Web applications.
The so-called P (Progressive) here has two meanings, on the one hand is the gradual enhancement, lets the web app experience and the function to be able to use the gradual enhancement way to be closer to the native app the experience and the function, on the other hand refers to the next generation Web technology, PWA does not describe a technology, but some technology's collection.
PWA Features
- Progressive Enhancement -enables every user to use whatever browser the user uses, as it is always the principle of progressive enhancement.
- Responsive user Interface -adapts to any environment: desktop PC, Smartphone, laptop, or other device.
- do not rely on network connectivity -through service workers you can work offline or in very poor speed.
- native -like applications-there is a native app-based interaction and navigation to a user-friendly experience, as it is built on the app shell model.
- Continuous Update -benefit from the update process of the service worker, and the app is always up to date.
- Secure -provides services over HTTPS to prevent network snooping and ensure that content is not tampered with.
- discoverable -thanks to the manifests metadata and service worker registrations, the search engine is able to find Web applications.
- Revisit-it's easy to get users to visit again with features such as message push.
- installable-allows users to keep apps that are useful to them on the home screen and does not need to be through the store.
- connectivity -easily share apps with URLs and run without complex installations.
PWA Advantages and Disadvantages:
- mentioned above, all of these modern Web features.
- The most important meaning of the web is openness and centrality, which is the purpose of the www.
Disadvantages:
- The threshold is not low. Server requirements for deployment Https,serviceworker involve many APIs and need to be learned separately
- Browser support is not comprehensive. Apple Safari will not be supported for a short time, 5-year plan may be implemented
- User experience habits. Web applications in lieu of native applications, users do not adapt for a short time
Key Technologies for PWAManifest (application manifest)
Web app Manifest is a specification that defines a JSON-based checklist that provides developers with a centralized place to put metadata associated with a Web application. Manifest is a part of the PWA concept that gives you control over how your application appears where the user expects it to appear (such as the user's phone home screen), which directly affects what the user can start and, more importantly, how the user launches it.
Using the Web application manifest, your app can:
- Be able to live on the user's home screen
- Ability to start full screen on Android without displaying the address bar
- Control screen orientation for best results
- Define a splash screen and define a theme for your site
- Track whether your app is launched from the home screen or the URL
For example:
{"Lang":"en","dir":"LTR","Name":"Donate App","description":"This app helps your donate to worthy causes.","Short_name":"Donate","Icons": [{"src":"ICON/LOWRES.WEBP","Sizes":"64x64","Type":"IMAGE/WEBP"},{"src":"Icon/lowres.png","Sizes":"64x64"}, {"src":"Icon/hd_hi","Sizes":"128x128"}],"Scope":"/racer/","Start_url":"/racer/start.html","Display":"fullscreen","Orientation":"Landscape","Theme_color":"AliceBlue","Background_color":"Red","Serviceworker": {"src":"Sw.js","Scope":"/racer/","Use_cache":false},"Screenshots": [{"src":"Screenshots/in-game-1x.jpg","Sizes":"640x480","Type":"Image/jpeg"},{"src":"Screenshots/in-game-2x.jpg","Sizes":"1280x920","Type":"Image/jpeg"}]}
Service Workers
A Service worker is a script that the browser runs independently of the Web page in the background, which opens the door to features that do not require Web pages or user interaction. This API is exciting because it supports offline experiences and gives developers full control over the experience.
The serviceworker is made up of two parts, a cache, and a Worker in part.
It is designed as a relatively low-level, highly programmable, sub-concept, and therefore exceptionally flexible and powerful API, it is like a proxy between the client and the network, can intercept, process, respond to the network requests flowing through, with the cache API, you can freely manage the network request file cache, which makes Service workers can provide resources from the cache to a web app, even in an offline environment. In this way, offline and the low speed of the case can also be opened, plainly, the previous hybrid architecture is not the appearance of this function. Although there are appcache, but it has a considerable number of defects, here do not say.
To the image of the official website map:
Push Notification (push notification)
Push and notification are two different functions, involving two APIs, but they have dependencies before.
Notification this piece should be understood a little bit, belong to the browser issued a notification message, before the browser must be open to achieve this notification, but now with the above mentioned service Worker, you can reside in the process operation.
Push & Notification Relationships:
- Push: The server side passes the updated information to the Service Worker
- Notification:service Worker pushes updated information to the user
PWA vs. other apps
The current mobile app:
- Native APP
- Web App
- Hybrid App
Native APP
Native app, refers to the native app, is a complete app, extensibility is strong, users need to download and install the use.
Advantages:
- All features of the mobile device can be used
- Fast speed, high performance, good user experience
- Offline use
Disadvantages:
- High development costs and high maintenance costs
- Every platform that doesn't work is going to be re-developed.
- App Store audits are complex and inefficient
Web APP
Web apps are apps written in the HTML5 language that live in the browser and do not need to be downloaded and installed.
Advantages:
- Cross-platform development, no download, no installation, fast development speed
- Release flexibility because no App store audits are needed at all
- Low cost of development
- Instantly available online
- Users can use the latest version directly
- Wide range of support devices
Disadvantages:
- Only a limited mobile device API can be used
- Browser compatibility issues
- Cannot upload to the store
- User temporarily not applicable
Hybrid App
Hybrid app refers to a semi-native semi-web hybrid app that needs to be downloaded and installed.
Advantages:
- Multi-platform Compatible
- Web front-end workers can quickly build
- Can be uploaded to the App Store
- Page debugging can be done in a browser-based manner
- The number of APIs that can be used for mobile devices
Disadvantages:
- User experience is less than native app
- To emulate native styles, a lot of HTML and CSS are required
- Slightly slower performance
- Technology is not very mature
PWA compatibility
Blink cores (Chrome, Oprea, Samsung Internet, etc.) and Gecko Kernels (Firefox) and Microsoft Edge have all the key technologies required for PWA to support, but iOS Safari (Webkit) , the API for PWA is not currently supported.
But in 2015 WebKit's 5-year plan, which already mentions service workers, is believed to be possible soon.
PWA in China
- Countries on the iphone are not a minority, while iOS is currently not supported by PWA
- Most of the domestic Android system has already removed the Google framework, so compatibility can be problematic
- Push relies on GCM, and domestic Google is inaccessible
Google's technology in the domestic push is very painful, although Android in recent years in the domestic good, but the development of PWA in China has many difficulties.
The future of PWA
In general, PWA is good, although there are some limitations to the experience of PWA in China, but I believe that PWA will come in the spring of China.
Here is a quote from Huang Xuan said:
Please do not let the Web continue to stay away from us, browser vendors have come together again, and the next bar will be delivered to our web application developer's hands. Steve Jobs believed that Web apps would be the future of mobile apps, so let's prove to the world in code.
Let our users love the Web as much as we do. "
PWA App Experience
Progressive Web Apps: The site contains a need for PWA apps that you can experience.
This chapter provides an introduction to PWA, which details the PWA API in a later section.
Blog name: Wang Leping Blog
CSDN Blog Address: http://blog.csdn.net/lecepin
This work is licensed under the Creative Commons Attribution-NonCommercial use-no derivative of the 4.0 International License Agreement.
PWA (Progressive Web App) Introductory series: (i) Introduction to PWA