The author | Maximiliano Firtman

The translator | Ken peng

With the release of iOS 11.3, Apple has quietly endorsed several of the new technologies behind the PWA concept: Service Worker, Web App Manifest, so let’s take a look at how they work, what they can do, what their challenges are, and what else you should know if you’ve already published a PWA App.

It’s a PWA on the iPad that’s full screen, can be used offline, and can be fixed to the Dock like any native App in the App Store

If you see this article also don’t know what is PWA, before I can tell you, it does not have a unique and accurate definition, but I can tell you is that it is a Web technology is used to create the App, don’t pack, without signature, can work offline, if you like, you can also add to the table, looks just like other applications.

On most platforms, PWA is not required to be installed from the App Store, except for Edge browsers and Windows 10, which require PWA to be in their App Stores.

So, you guessed it, you can now install apps on iOS without going through the App Store. This may be one reason why Apple didn’t mention this new capability directly, they probably didn’t want to switch users, and didn’t even mention the technology in Safari’s release notes.

Can you tell the difference? One is native Google Maps and the other is PWA

Isn’t Apple the creator of PWA?

To be honest, the Google Chrome team created PWA, but the project was first proposed in Safari on the original iPhone OS, and in 2007, Steve Jobs announced “One More Thing” at WWDC: How to develop apps on the original iPhone, and surprisingly, Web apps. The App Store wasn’t in the original plan at the time, and the native SDK wasn’t available for the first year of the iPhone’s release. From Apple’s point of view, even today the PWA is simply “webapp on the home screen”, with ICONS referred to as Webclips.

If you’d like, check out the video of my talk at Fluent Conference last year, where I mentioned this at the 10:50 mark. Video link address:

https://link.zhihu.com/?target=https%3A//www.youtube.com/watch%3Ftime_continue%3D651%26v%3DEFGltzFSK-c

Eleven years ago, the idea didn’t get much traction and Apple forgot to update the capability, so for 10+ years the feature was flawed and unstable. Several years later, other platforms implemented the idea, including the MeeGo browser on the Nokia N9 and Android Chrome.

Chrome helps improve and implement these technologies to provide a better user experience, as reflected in the Service Worker and Web App Manifest specifications. Starting today (March 30, 2018) with iOS 11.3, Apple is following Chrome, Firefox, Samsung Internet, UC Browser and Opera with support for both odd-numbered specifications, Safari for Mac already supports Service workers, and Support for The Web App Manifest is in the works this year.

Steve Jobs demonstrating PWA on WWDC’s first iPhone in 2007 (it wasn’t called PWA at that time)

Wait, so these apps don’t pass the App Store’s quality tests, right?

Yes, you guessed right again. However, PWA currently only works in browsers or other Web platform security policies, which means you can “publish” apps that are not approved in the App Store, such as internal apps for your employees (including approved content), but can’t use some Native apis. Like Face ID on the iPhone X, or ARKit augmented reality, or at the very least, you’ll have to wait for the Web to support these new apis.

The PWA can be run in Safari as a normal website, or in standalone mode (without the address bar and other features of Safari), just like any other application in the system.

PWA capabilities in iOS

On the iOS Web platform you can call the following apis:

  • Geographic location

  • Sensors (gyroscope, accelerometer, magnetometer)

  • The camera

  • Audio output

  • Speech Synthesis (headphones only)

  • Apple Pay

  • WebAssembly, WebRTC, Web GL, and many more experimental features

Can you tell which are PWA and which are native apps?

What are the limitations compared to native iOS apps

PWA can only store up to 50Mb of offline data and files

  • If the user does not use the PWA for a few weeks, iOS will release the PWA cached files. The desktop icon will remain, of course, and the file will be recached the next time the user accesses it

  • Some Native apis, such as Bluetooth, Touch ID, Face ID, ARKit, and battery information, cannot be applied

  • Unable to execute code in the background

  • You cannot access private data, such as contacts, or local social applications

  • Unable to access In App Payments and many other Apple-based services

  • On the iPad, there’s no way to use split-screen sharing with other apps, and the PWA takes up the entire screen all the time

  • No notifications, no Siri integration

If you have a PWA called Tinder installed, Siri can’t find it

What works on Android and what doesn’t on iOS?

You can store up to 50Mb of data and files on Android

  • Android won’t delete the PWA files when you don’t use it for a long time, but it will delete files when it runs out of storage space. PWA can use permanent storage if the user installs and uses a lot of it

  • Bluetooth access for BLE devices

  • The Native Share dialog can be used on the Web on Android through the Web Share API

  • Speech recognition

  • Background synchronization and offline message push

  • An installation dialog box is displayed asking you to install the PWA

  • You can customize the (limited) PWA splash screen and decide whether the PWA is portrait or landscape

  • In WebAPK and Chrome, a PWA can only be installed once

  • In WebAPK and Chrome, the PWA appears in “Settings” and you can see the data usage, while in iOS, everything is included in Safari

  • In WebAPK and Chrome, the PWA captures your URL, and if it’s a PWA link, it opens the PWA in standalone mode, not the browser

What works on iOS and doesn’t on Android?

  • Users can change the PWA name before installation

  • This can be modified in the configuration file, so enterprise users can install PWA from the company (this is a good point), Safari calls this WebClip (probably not reading the Web App Manifest standard)

Profiles contain WebClips and PWA ICONS

How do I install PWA on iOS?

This is one of the most important challenges on iOS, because iOS Safari doesn’t have any reminders or Banners for users to add PWA; Android clearly has a banner of Web App Install integration users, so users need to visit your site in Safari first. Then manually click the Share icon and click Add to Home Screen. At no point in the whole process does it show that this is a PWA.

After clicking the “Share” button, click the “Add to desktop” button, and the Web App itself should guide the user. Please do not forget the current system language during the guidance

Other browsers installed from the App Store, such as Chrome, Firefox, Brave or Edge, cannot install PWA or use Service Worker.

Once installed, it looks just like any other icon on the home screen, and while it won’t have a 3D Touch menu, if you install the same PWA again, you’ll have another icon pointing to the same PWA (fortunately, the installed files will be shared).

In addition, many Web apps have a prominent location that directs users to download and install native apps from the App Store, and this is shown in the PWA, which is actually a detriment to the user experience, such as Tinder:

I already have PWA installed, don’t try to guide me to download Native App

I already have the PWA site, can iOS users use it now?

After you upgrade to iOS 11.3, you can install your PWA. No extra configuration is required for iOS. Every PWA can be installed, but that doesn’t mean everything will be as you think.

Uber PWA looks really good, but when you click the sign in or Continue button, the authorization page opens Safari, which jumps out of the PWA running on its own

If you’re reading this, you may have already posted my article Cupertino, We’re In trouble when the iOS PWA was still in beta. The bad news is that most of the problems we encountered during the beta are still with us after the iOS 11.3 release.

If you do nothing, your PWA will have overlapping black bars on top, invisible time, battery, other letters, status bar

What doesn’t work?

  • Display issues: Fullscreen and minimal-UI are not supported on iOS, fullscreen is the same as standalone mode, and minimal-UI is just a shortcut to Safari. But you can achieve a similar fullscreen effect by using a cover-fit or deprecated private meta tag (the status bar will be in, but will be overlaid on your app)

  • Background sync is not yet supported

  • Unable to lock PWA orientation, landscape or portrait

  • The theme-color property does not work and you cannot change the color of the status bar. You can use deprecated private meta tags to set the status bar to black or white, or you can use CSS/HTML to simulate the theme-color

Starbucks PWA has no back button on the registration page, so you cannot cancel the current registration process. You need to restart the PWA

  • If your PWA doesn’t have a back gesture or a back button, users won’t be able to switch between pages

  • IOS doesn’t support transparent ICONS, so be careful

Google Keep PWA only sets the icon in the Web App Manifest, so the icon added to the desktop is the current screenshot, and you need to set Safari’s private properties to customize the icon

  • In iOS, you can’t use the icon in the manifest.json file, but you can use the icon set by the app-touch-icon link tag. If you don’t provide this link tag, Safari will use the screenshot as the icon. See the Google Keep PWA example above

  • There is no splash screen, so most color attributes in the Web App Manifest are ignored

  • No manifest-related events will be triggered, so you can’t tell if the user is installed by the event, but you can tell by navigator. Standalone if the user is running in standalone mode

What to remember?

  • The PWA does not persist between sessions, and if the user cuts out the PWA to another App, it will restart when it comes back, so if you need the user to authenticate email, SMS, or switch to another App for authentication, please consider another implementation

All PWA that are not activated have a white screen, whether they were or not before, remember, they are not running, and if you cut back to the PWA, it will restart with the same white screen problem on the iPad

  • The PWA on the back doesn’t have screenshot thumbnails, they all look white, which is a shame

  • There may be bugs when your app runs in standalone mode, do not test your PWA with Safari alone

NASA’s PWA had some experience issues

  • If you want your PWA to take advantage of the iPhone X’s notched area, special HTML/CSS processing is required, and if you don’t do it right, it will look weird

  • Sometimes, when you add to the home screen you don’t have the manifest file, you just add a shortcut ☹️

Starbucks logo on Google Maps? No, it’s just that iOS has some weird bugs when using multiple PWA in a row, where the PWA loads the wrong URL

  • Safari shares the same Service Worker Registration (not Service Worker instance) and cached files with the PWA added to the home screen, Safari View Controllers (such as Twitter’s in-app browser) also support the Service Worker and Cache apis, but seem to delete all data after the session is closed

  • All third party browsers (Chrome, Firefox, etc.) and all apps that use WebView (Facebook in-app browser, etc.) don’t support Service workers, and my guess is, WKWebView may need an API to let application developers decide how to use Service workers, but… Who knows?

With Safari TP, you can debug Safari and PWA on the home screen, you can debug Service workers, and you can catch network requests

  • To debug Service workers on iOS, you need to install Safari Tech Preview or Safari 11.1

Debugging tools for Service workers are still experimental; for example, you won’t see anything in CacheStorage yet

  • Service workers can be disabled by setting -> Experimental features (enabled by default)

What is the application of this blank?

  • Sometimes, you have a lot of PWA open at once, and the iOS taskbar gets weird, showing a ghost app with no icon or title

If you find any other bugs with PWA on iOS, please comment below and I’ll put together a bug report for the WebKit team. If you want to keep up to date on this post, please also follow me on Twitter @FIRt. If you’re in the Bay Area in June, We will create a PWA that covers things that most people lack on other platforms, as well as how to survive on iOS 😀.

If you find any other PWA bugs on iOS, please comment below and I’ll put together a bug report for the WebKit team. If you’d like to keep up to date on this post, please also follow me on Twitter @FIRt. If you’re in the Bay Area in June, Take a look at the PWA training I’m going to teach you. We’re going to create a PWA that covers things that most people don’t have on other platforms, and how to survive on iOS.

Medium, you know: https://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7

Recommended reading

(Click the picture to jump to)

The way things are going, PWA is going to create a lot of demand for Web apps, and another big front-end shake-up is likely just around the corner.

— Will PWA bring another Big front-end technology shuffle?

Brilliant Open Web 

The BOW (Brilliant Open Web) team is a dedicated Web technology building group dedicated to promoting Open Web technology and bringing the Web back to the forefront of developers.

BOW focuses on the front end, on the Web; Analyze technology and share practice; Talk about learning. Talk about management.

Follow OpenWeb developers, reply to “Add group”, let’s promote the development of OpenWeb technology together!


OpenWeb developers

ID: BrilliantOpenWeb

Technology connects the world, openness wins the future