Progressive Web Apps (PWAs): A web-mobile integrated solution

Kartikey Tandon
Blockchain Research Lab
6 min readFeb 13, 2023

Have you ever wished you could develop a mobile app using your existing web development skills? What if you could create an app that works on both web and mobile platforms with the same codebase? Let’s dive into the world of PWAs!

Progressive web apps are web applications that leverage modern web technologies to provide users with a native app-like experience, such as offline functionality, push notifications, and access to device hardware, while still being accessible via a web browser. They are designed to be responsive, fast, and reliable, and can be installed on a user’s device like a traditional native app, making them accessible from the home screen.

Mobile Web vs Native Apps

Image showing an average user spends 87% of their time on Native apps and 13% on Web
Usage comparison between Web and App user

An average user spends 87% of their time on Native Apps, but ever wondered why? Here are the reasons:

  1. There are push notifications that keeps user engaged and bring them back.
  2. Home screen icons makes Access to the application easy.
  3. Some Device features like camera also add some value to this.
  4. And obviously, most of these Native apps work offline.

While we see that there is more engagement on Native apps but there are more users on Web than Native Apps.

Stats sowing more engagement on Apps but more users on Web
Stats sowing more engagement on Apps but more users on Web

By adding features such as push notifications, camera access, and offline accessibility with the help of modern web technologies, web apps can behave similarly to native apps without requiring developers to learn new languages. This means that existing web development skills can be leveraged to create apps that provide a native app experience, without the need for additional training.

Native Apps vs Web Pages vs PWAs

Native Apps — It has access device features but have you ever thought about the average number of new apps do a single user install in a month? Possibly the answer is Zero. Users usually have specific standard apps for their each and every tasks like Whatsapp or Instagram as the social media platforms. So, one can easily conclude that the reach of the Native App is not that much while only top three apps win and the rest lose.

Traditional Web Apps — It doesn’t have access to device features and of course, they can’t run offline but the reach is much higher than Native apps.

Progressive Web App (PWAs)

And then comes the master of all, The Progressive Web Apps. It has Native features like Accessing device features. It has a higher reach. In simple language, The Progressive Web Apps is the combination of the positives of both Native Apps and Traditional Web Pages.

Building Blocks of PWAs

Service Workers

Service worker is a Javascript file that runs in the background of a website and can handle tasks like managing offline content and speeding up page load times. It also allows us to enable other PWA features, such as Background Sync, push notifications and many more.

Let’s understand Push notification, push notifications are a type of message that can be sent to a user’s device or browser, even when the user is not actively using the app or website. These notifications are “pushed” to the user’s device or browser from a server, without the user having to actively check for updates.

What about Background Sync?

Let’s take a real life example, often you must have seen that if you are using instagram and you liked one of the posts out there and at the same time your internet connection is lost then the request will be synced in the background and whenever the internet connection is back a like request would be sent and your like would be updated.

Image telling how Websites are added to your home screen and can be uesd as a PWA
Clicking in Add to home screen will result in creating a separate App for the Website

Application Manifest

The Application manifest makes the Application installable on your home screen. Basically it’s a JSON (Javascript Object Notation) file that provides information to the browser about how to display and behave with a web application when it is installed on a user’s device or added to the home screen. It provides information such as the name of the application, icons to use, the start URL and other things that control how the application should look and feel.

Responsive Design

Responsive design is an approach to web design that aims to provide an optimal viewing and user experience across a wide range of devices that includes desktop computers, tablets and smartphones.

Geolocation API

The geolocation API is a web API that allows web applications to access a device’s location information, such as latitude and longitude coordinates. This API works by using various location sensors on the device, such as GPS, Wi-Fi, and cellular networks, to determine the device’s location.

In simple terms, it allows access to user’s location.

Media API

Media APIs allow access to the device camera and microphone.

Pop us about Permission Access of Media
Permission Access

and more….

Do you know Twitter Lite is a Progressive Web App

How to get Started with building Progressive Web Apps?

Angular is often considered best for making PWAs but if you are doing React you can continue to do so but remember that React or Angular are not essential for getting started building with PWA.

Here’s a Basic code for a PWA you can write, you just need basic knowledge of HTML, CSS & Javascript and if you’ve come this far through the Blog you’ll be able to understand the following code.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My PWA</title>

<!-- Add manifest file -->
<link rel="manifest" href="/manifest.json">

<!-- Add service worker -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/service-worker.js');
});
}
</script>
</head>
<body>
<h1>Hello, world!</h1>
<p>Welcome to my PWA.</p>
</body>
</html>

The Result.

Output to the Code, a simplest PWA
Simplest PWA

This seems like a basic Website but it’ll now behave like a PWA.

Summary

  1. Progressive web apps (PWAs) use modern web technologies to provide users with a native app-like experience on both web and mobile platforms.
  2. By adding features like push notifications, camera access, and offline accessibility, PWAs can behave similarly to native apps.
  3. PWAs are a combination of the positives of both native apps and traditional web pages, with high reach and native features.
  4. The building blocks of PWAs include service workers, application manifest, responsive design, geolocation API, media API, and more.

Remember, Progressive Web Apps are the next big thing in Web Development as they bring mobile-app-like experiences to your users without requiring them to install an app from the app store/ play store.

Keep exploring and learning….

--

--