Objective
The advantage of PWA as a new technology for web-side launches by Google is self-evident. But the knowledge of the relevant aspects is not very rich at the moment. Here I introduce a series of tutorials for beginners in this area. Provides 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. Implement a user experience that is similar to native apps in Web applications.
The so-called P (Progressive) has a two-layer meaning, on the one hand, a progressive enhancement that allows the experience and functionality of the Web app to be progressively enhanced to be closer to the native app experience and functionality. On the other hand is the next generation of web technologies. PWA does not describe a technology. But a collection of technologies.
PWA Features
- Progressive Enhancement -enables every user to use. No matter what 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.
- does not rely on network connectivity -through the service workers can work in an offline or extremely low-speed environment.
- native -like applications-there is an experience that is native to the user, 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. Ensure that the content is not tampered with.
- discoverable -thanks to the registration of the manifests metadata and service worker. Enable search engines to find web apps.
- revisit -make it easy for users to re-visit through features such as message push.
- Installable- allows users to keep their useful apps on the home screen and does not need to pass through the App Store.
- connectivity -easily share apps with URLs that can be executed without complex installation.
PWA Advantages and Disadvantages:
- All of these modern Web features are mentioned above.
- The most important meaning of the web is openness and centrality, which is the purpose of the www.
Disadvantages:
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 app is going to appear to users today (for example, a user's phone home screen). This directly affects what the user can start. and more important. How the user starts 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
Like what:
{"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"}]}
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbgvjzxbpbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "alt=" "title=" ">
Service Workers
A Service worker is a script that the browser executes 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 complete control over the experience.
Serviceworker is composed of two parts. Part of the cache is the other part is the Worker.
It is designed as a relatively low-level, highly programmable, sub-concept, and therefore exceptionally flexible and powerful API, which is like a proxy between the client and the network. The ability to intercept, process, and respond to network requests that flow through, along with the cache API, allows you to freely manage the caching of network request files, allowing Service workers to provide resources from the cache to Web applications, even in offline environments.
Such In the case of offline and low speed can also be opened in seconds. Frankly speaking, the previous hybrid architecture is not the first to do this function.
Although there were appcache before. But it has quite a few flaws, and here it is not said.
To the image of the official website map:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbgvjzxbpbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "alt=" "title=" ">
Push Notification (push notification)
Push and notification are two different functions, involving two APIs, but they have dependencies before.
Notification this piece should be a little bit more familiar to everyone. A notification message that belongs to the browser. Before the browser has to open the ability to achieve such notification, but now has the above mentioned service Worker. will be able to reside inside the process.
Push & Notification Relationships:
- The Push:server side passes the updated information to the Service Worker
- Notification:service Worker pushes updated information to the user
Comparison of PWA with other apps
Mobile app for now:
- Native APP
- Web App
- Hybrid App
Native APP
Native app, refers to the native app. is a complete app. Scalability is strong, users need to download and install the use.
Strengths:
- 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 has to be developed again.
- App Store audits are complex and inefficient
Web APP
Web app refers to apps written in HTML5 language. Apps that live in the browser. There is no need to download the installation.
Strengths:
- Cross-platform development, no download, no installation, fast development speed
- Release flexibility. Because there is no need for App store audits
- Low cost of development
- Instantly available online
- Users are able to use the latest version number 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 temporary Not applicable
Hybrid App
Hybrid app refers to a semi-native semi-web hybrid app that needs to be downloaded and installed.
Strengths:
- Multi-platform Compatible
- Web front-end workers can build at high speed
- Ability to upload to the App Store
- Ability to debug pages 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 the native style. Requires a lot of HTML and CSS
- Slightly slower performance
- Technology is not very mature
PWA compatibility
The Blink core (Chrome, Oprea, Samsung Internet, etc.) and the Gecko kernel (Firefox) and Microsoft Edge have all the key technologies that PWA needs to support. But iOS Safari (Webkit). The PWA API is not supported at this moment.
Only in the 2015 WebKit 5-Year plan, the service Worker was mentioned. I believe it can be achieved very quickly.
PWA in China
- Country on the iphone is not a minority, and iOS is not supported by PWA right now
- The majority of Android systems in China have already removed the Google framework. So compatibility can be problematic
- Push relies on GCM. And the domestic Google is not access to ask
Google's technology in the domestic push is very painful, Android despite recent years in the domestic good, but the development of PWA in the country has very many difficulties.
The future of PWA
In general, PWA is very good, although there are some limitations to the experience of PWA in the country, but I believe that PWA will certainly 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 handed over to our web application developers. 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 the need for PWA applications, you can experience.
This chapter does a bit about PWA. The following sections specifically describe the PWA API.
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) PWA Brief introduction