Cloudinary Blog

Media-Heavy Apps? Progressive Web to the Rescue

By Mike Elsmore
Why you should care about Progressive Web Apps

This is Part 1 of a 3-part series.

I’m not going to lie, Progressive Web App (or PWA) have become a bit of a buzzword, with many developers singing its virtues and proclaiming that it solves all of their problems. Progressive Web Apps aren’t going to cure cancer or make you a billionaire on their own. But they can make your Web Apps a lot more approachable and performant.

Before we start talking about why you should care about Progressive Web Apps, maybe we should first explain what they are. A lot of people assume that Progressive Web Apps are a Google product, since the term was coined by Google employees Frances Berriman and Alex Russell. However, the phrase describes how one can build a web app using technologies from modern browsers to provide a more “native” app feel, and in the case of Progressive Web Apps on Android, actually behave entirely as native apps.

According to Google Developers, a Progressive Web App is:

  • Progressive - Works for every user, regardless of browser choice, because it's built with progressive enhancement as a core tenet.
  • Responsive - Fits any form factor: Desktop, mobile, tablet or whatever devices may be next.
  • Connectivity independent - Enhanced with service workers, enabling it to work offline or on low-quality networks.
  • App-like - Feels like an app, because the app shell model separates application functionality from application content.
  • Fresh - Always up-to-date as a result of the service worker update process.
  • Secure - Served via HTTPS to prevent snooping and to ensure content hasn't been tampered with.
  • Discoverable - Is identifiable as an "application" thanks to W3C manifest and service worker registration scope, enabling search engines to find it.
  • Re-engageable - Makes re-engagement easy through features like push notifications.
  • Installable - Allows users to add apps they find most useful to their home screen without the hassle of an app store.
  • Linkable - Easily shared via URL, does not require complex installation.

All of these characteristics are provided by a few technologies available to all modern browsers in the form of an HTTPS connection, Web manifest and service workers. For most developers, this means that you now have a lot more toys to deliver a better user experience. It also means that you can create a more interactive app regardless of the end-user network connection.

Media Needs Progressive

But why should you care about Progressive Web Apps? Well, most obvious is the ability to improve the user experience. Just by super-charging your existing app with Progressive Web App, end users will get a web app that looks and behaves like a native app, an experience they’re accustomed to.

The most complex, fascinating and useful part of the technology needed for Progressive Web Apps is the service worker, which carries out essential content functions via offline caching and remote access. In tandem with a service worker, an image backend like Cloudinary facilitates media handling tasks, such as optimization and data processing (sometimes referred to as an Image CDN).

Currently, the most complete service worker APIs are the fetch API, push notifications, caching and background sync (with periodic sync expected shortly). Push notifications give a great user experience and performance boost as you have to do fewer GET/POST loops in your UI javascript. However, the best performance boost is from the caching and background sync.

With the install event in the service worker, you can force the browser to get and cache all large assets, including CSS & JS files. It can also be useful for other assets used throughout the app and any assets bulky enough that justify an early get and cache. The sync event enables you to make requests when the device is back online and to cache them when the connection dies or become flaky, in order to queue what to load next.

The crown jewel of service worker events is the fetch. This event enables you to intercept and modify HTTP requests. A powerful use case example is to check, for every request, if the cache has a version with a relevant TTL and getting it, if it doesn’t. Imagine the power to get images and videos off a lightning fast CDN and being able to cache them (or pre-fetch them) based on other HTTP requests or data changes in the browser.

The Power Within

The majority of web apps produced are either data intensive or contain content that is download intensive, like images and videos. Such media is seeing increased use as good data connections instigate shoving more content down the pipe. As a result, user experience degrades considerably in areas of poor connectivity, even if you’ve optimized everything at the server-side.

Taking advantage of the fetch and sync events to cache the chunkier pieces, or even pre-fetch and cache them, means that your users get a better perceived experience and we, as developers, can worry less about the flakey bits between the servers and the browser.

If you are feeling ready to take the plunge and try making your web apps more progressive, tools do exist to point you in the right direction. The biggest and easiest to use of these is the Lighthouse project, which is a Google project but open for anyone to use. This test suite validates that your app follows the tenets required of a Progressive Web App. It’s also a great tool for checking performance and usability. It comes in many flavors - from a NodeJS-based CLI through to a Google Chrome extension.

Now you know what Progressive Web Apps are, why you should care about them and even where to make sure they fit the standard. So go ahead, play with modern browser features and make your apps better and more progressive!

jQuery Progressive Web App Example

Mike Elsmore Mike Elsmore loves building, tinkering and making odd things happen with code, using his time to share knowledge on rapid development and database technologies. Most of the time, he can be found in the middle of building a prototype that combines JavaScript, server tech and odd APIs. Mike also happens to be an active participant in the hacker subculture, taking part in hackathons and development conferences, as well as running his own.

Recent Blog Posts

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more