Cloudinary Blog

Media-Heavy Apps? Progressive Web to the Rescue

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

Generate Waveform Images from Audio with Cloudinary

This is a reposting of an article written by David Walsh. Check out his blog HERE!
I've been working a lot with visualizations lately, which is a far cry from your normal webpage element interaction coding; you need advanced geometry knowledge, render and performance knowledge, and much more. It's been a great learning experience but it can be challenging and isn't always an interest of all web developers. That's why we use apps and services specializing in complex tasks like Cloudinary: we need it done quickly and by a tool written by an expert.

Read more
Make All Images on Your Website Responsive in 3 Easy Steps

Images are crucial to website performance, but most still don't implement responsive images. It’s not just about fitting an image on the screen, but also making the the image size relatively rational to the device. The srcset and sizes options, which are your best hit are hard to implement. Cloudinary provides an easier way, which we will discuss in this article.

Read more

The Future of Audio and Video on the Web

By Prosper Otemuyiwa
The Future of Audio and Video on the Web

Web sites and platforms are becoming increasingly media-rich. Today, approximately 62 percent of internet traffic is made up of images, with audio and video constituting a growing percentage of the bytes.

Read more

Embed Images in Email Campaigns at Scale

By Sourav Kundu
Embed Images in Email Campaigns at Scale

tl;dr

Cloudinary is a powerful image hosting solution for email marketing campaigns of any size. With features such as advanced image optimization and on-the-fly image transformation, backed by a global CDN, Cloudinary provides the base for a seamless user experience in your email campaigns leading to increased conversion and performance.

Read more
Build the Back-End For Your Own Instagram-style App with Cloudinary

Github Repo

Managing media files (processing, storage and manipulation) is one of the biggest challenges we encounter as practical developers. These challenges include:

A great service called Cloudinary can help us overcome many of these challenges. Together with Cloudinary, let's work on solutions to these challenges and hopefully have a simpler mental model towards media management.

Read more

Build A Miniflix in 10 Minutes

By Prosper Otemuyiwa
Build A Miniflix in 10 Minutes

Developers are constantly faced with challenges of building complex products every single day. And there are constraints on the time needed to build out the features of these products.

Engineering and Product managers want to beat deadlines for projects daily. CEOs want to roll out new products as fast as possible. Entrepreneurs need their MVPs like yesterday. With this in mind, what should developers do?

Read more