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

How the Right Tools and Training Drive SDR Success

Here at Cloudinary, I head a team of eight SDRs, who are responsible for creating the first impression potential customers have of our company’s brand. In just the first 10 months of 2017, our team of outbound SDRs have been responsible for sending more than 67,000 personalized emails and making more than 15,000 calls.

Read more
The JS video player that developers will love (How To)

It doesn't take a genius (or a statistician) to know that video represents a significant proportion of web and mobile content these days. But did you realize that in 2017, video will account for about 75% of all internet traffic and that 55% of people watch videos online every day? In fact, 52% of marketing professionals worldwide believe that video is the content type with the best ROI, with people spending up to 2.6x more time on pages with video than on those without.

Read more
 Beyond Drupal Media: Make Images and Video Fly with Cloudinary

Drupal is a very popular open source content management system (CMS) that has been deployed countless times by organizations and developers around the world. Drupal gained a reputation for being very flexible, powerful and robust in creating complex websites. With Drupal, you can create everything from plain websites, blogs and forums to ambitious enterprise systems.

Read more
Curbing Terrorist Content Online

Today, Cloudinary is proud to announce that it has joined The Global Internet Forum to Counter Terrorism (GIFCT), to help fight the spread of terrorist and violent extremist content on the Internet. The forum was established by Facebook, Microsoft, Twitter and YouTube in mid-2017. Cloudinary will contribute to the hash-sharing database, which all contributing companies can use to help identify and block terrorist related images and videos upon upload.

Read more
Introducing the complete video solution for developers

Videos in web sites and apps are starting to catch up with images in terms of popularity and they are a constantly growing part of the media strategy for most organizations. This means bigger challenges for developers who need to handle these videos in their web sites and mobile apps. Cloudinary's mission is to solve all developer needs around image and video management. In this blog post, we are excited to introduce Cloudinary's complete cloud-based video management solution for developers.

Read more