Salin ke papan keratan gagal, sila cuba lagi selepas melaraskan kebenaran anda.
Disalin ke papan keratan.
PWA programming with attitude.
Whether you’re confined to a stuffy train cabin for hours a day, begging for the receptionist to call your name in the medical centre lobby or keeping sleep at bay with a luminescent stream of headlines and memes, a huge portion of digital natives experience the internet almost exclusively on smartphones. It’s how a huge portion of us engage with the internet but stats as recent as February 2019 show the market share is still an even split, with 48.21% of website traffic coming from desktop computers, 47.96% from mobile/smartphone devices and a lowly (but not insignificant) 3.83% of traffic coming from tablets.
To accommodate this split between desktop browsing and smartphone swiping, most websites have adopted a responsive, mobile-first approach to design after the last decade. Keyword, “most”... In 2019, there are still a ton of websites that haven’t. Often, these dastardly desktop-first offenders engage with their users via a mobile app for the majority of the transaction or experience while sending them to a non-responsive web page for particular actions or features (like updating account information).
These services rest on their laurels by offering an acceptable app experience while making things difficult for mobile users who dare change their password or update their credit card details. Many companies fall for the dated belief that any and every service needs an app store presence and focus their resources on iOS and Android development.
Other websites do just fine at making their websites responsive with a mobile-first approach but for many companies, mobile-first begins and ends with responsiveness: scaling font weight and size, collapsible tables and more max-width: 100% more CSS than you can possibly imagine. But what if you didn’t need a native app to give your users that smooth, gesture-based user experience? What if you could build a website that is optimized for desktop and mobile use from the ground up? You don’t and you can. Let us introduce you to PWA, Progressive Web Apps.
What is a PWA?
At first glance, PWAs might look like any other web app but they differentiate themselves by offering the experience and feel of a native app. In short: it’s the best of both worlds, offering the benefits of a native app user interface (UI) while operating like a normal web app on browsers. Progressive Web Apps are built using a relatively new software development methodology.
PWAs are an improvement on the existing web technologies we already use and don’t require any additional bundling or distribution so implementation is a cinch compared to other web technology migrations.
Why would I develop PWA over a native app?
There are many reasons why developers believe PWA is the future for web development but the short and skinny of it is this: cost. Native app development can be pricey and the resources required to maintain them could be put to use elsewhere. PWAs work on most browsers and operating systems out of the box, so they negate the need to split development costs across separate priorities. They consolidate everything so your team can focus-fire on improving one app/website, rather than two or three different platforms.
Companies that have already adopted PWA, like Alibaba, have even credited increased conversion rate and purchases per customer on the switch from native to PWA. Back in 2016, the mammoth B2B trading platform reported a 76% increase in conversions across browsers, a 14% increase in monthly active users on iOS, a 30% increase on Android and 4 times as many interactions with the “Add to homescreen” prompt after switching to PWA.
So should you switch from native development to PWA? Well, do you love that cold, hard cash, dear reader? Of course, the increase in revenue won’t come magically. It’s what you can do to improve user engagement that brings about that result. By focusing all your energy into one PWA, more time and resources can be spent on the overall UX and UI of your service/website, making your users happy and your wallet even happier.
If PWA is so good, where are the successful websites that already use it?
We’re glad you asked. Many apps you use every single day are already using PWA. As the methodology’s biggest proponent, Google is already using PWA on some of its most popular services, like Google Maps and Google Photos. If you vaguely remember the moment the Google Maps website stopped acting like a website and started behaving like an app on mobile devices, then you remember the moment it switched to PWA.
Examples of this can be seen across some of the world’s biggest services on the web; Twitter, Tinder, Uber, Flipboard, Telegram and The Washington Post have all made the switch to PWA over the last few years. But why take our word for it? You can experience the PWA with one quick exercise:
Locate the Google Maps app on your smartphone and delete or disable it (don’t worry, you won’t lose any data).Open Google Chrome, search “Google Maps” and click the first link. You will see Google Maps in its entirety, working as you’d expect, within the browser (as well as a call-to-action at the bottom of the page asking you to add Google Maps to your homescreen).Bonus round: Just for giggles, switch your smartphone to airplane mode and refresh the page. You will notice the PWA still loads (although some features might be restricted).Boom. You’ve just witnessed the power of PWA, firsthand.
I’m sold. How do I build or switch to PWA?
Switching to PWA isn’t as hard as it sounds. And even if it does end up being harder than it sounds, there are plenty of freelance developers with the responsive know-how to help you through.
If you’re not building your website from the ground up as a PWA, you can switch by following a few simple steps. You will need an Android device running Chrome 52 or above, some background knowledge of git and Chrome DevTools, the sample code, a standard text editor and HTTPS authentication. You, or your development team, will need to clone the GitHub repository in order to develop a directory for migrating to PWA, update your head tags with mobile-friendly viewport meta tags and a Web App Manifest, add, create and register a Service Worker and enable the entire website to cache and work offline. That’s the express version of it.
There are a lot of steps in-between and the workload will vary depending on the complexity of your existing site but the bones of the process are relatively straightforward. If you’re a developer with experience building responsive websites, you should breeze through the process but if you don’t have a dev background or you’re building a website for the first time, we strongly recommend recruiting the help of someone with a little technical know-how.
Can I submit my PWA to the App Store and get the best of both worlds?
One big drawback of PWAs is that, for all intents and purposes, they behave like an app with the exception of hardware and operating system compatibility. Some platforms make it difficult for PWAs to access hardware features, like GPS, Camera or Microphone, or to take advantage of OS ecosystem features (e.g. music controls on the lock screen). iOS, in particular, flat out prevents web apps from requesting permission for the privileges given to native apps.
If you want your PWA on the App Store, you are required to write a native app wrapper with something like Cordova to get it on the App Store and interacting with iOS like a native app. Then there’s the cost of admission. Apple still stings creators $99 USD per year to have their app listed on the App Store. Getting listed on the App Store is a headache, even with native, and getting a PWA live complicates things further.
To build an iOS app, you need XCode, which is only available on Mac (so you need a Mac computer), then you need to be certified for Apple’s developer program. After all of this, you need to link your Apple developer certificate with an iTunes Connect account. Then, finally, once you’ve jumped each of these hurdles, you need to go pour yourself a stiff whiskey and abandon the project entirely. But the answer is yes, you can have your cake and eat it too — it just takes a little extra effort.
Things are wildly different on Google Play and Microsoft. Google Play’s certification runs through Android Studio (which is available across Mac, PC and Linux) and is, by every measure, a far less painful experience. There is a once-off $25 USD fee for submitting but that’s a small price to pay for convenience.
For the Windows Store, you simply need to create an .appx package with something like Visual Studio before submitting to the Microsoft Dev Center. The best part is that it’s completely free. Better yet, Microsoft is setting the pace for PWA adoption by automatically adding PWAs to the Microsoft Store as soon as they are crawled by Bing. Back in 2018, Microsoft experimented by adding 10 PWAs to its store (including big-name websites like Skyscanner and ASOS). At the time, Microsoft stated that PWA apps would be treated as “first-class citizens” in Windows 10 which is an attitude we hope Apple learns from. Because, whether Apple is invited or not, the PWA party is just beginning and the future of this exciting methodology (and the companies that take advantage of it) is bright.