Sulav Jung Hamal - Blog - 2023/11/08 -
Web technologies are ever so changing. It is progressing in the right direction allowing people to have a better experience interacting with it. From early web applications to the latest, there have been many changes to it. Along with support for more API that can interact with the native operating systems APIs. One of the benefits of such support of APIs is directing us toward the PWAs or Progressive Web Applications. Progressive Web Apps (PWAs)
have emerged as a transformative force, bridging the gap between traditional web applications and native mobile apps. PWAs offer a seamless user experience, combining the best of both worlds – the accessibility and reach of the web with the app-like features and capabilities of native apps.
PWAs
aren't any different than the web applications. They are built using the same combination of modern web technologies, including HTML
, CSS
, and JavaScript
. Additionally, to run your web application as PWAs, you should have web app manifest
and service workers
set up in your web app. These technologies allow the browsers and the operating system to acknowledge your web applications' capability to run as PWAs. Along with that, they provide several key advantages over traditional web applications:
PWAs can be installed directly onto a user's device, similar to native apps. This allows users to launch PWAs directly from their home screen or app drawer, providing a more app-like experience. It also increases the productivity of the user as they do not need to go through the browser every time.
The chances of an app use increases significantly if it is allowed to be used without the internet. PWAs can cache content and resources, allowing them to function even when a device is offline. This is particularly useful for scenarios where internet connectivity is unreliable or intermittent.
Similar to Instagram, Facebook, and other social media app notification badges and numbers on the app icon, PWAs can also have those functionalities. PWAs can send push notifications to users, providing real-time updates and engagement opportunities, similar to native apps using Web Push Notifications API. You can also configure, timely and auto-push notifications.
Users do not want to wait for the web pages to load. The lag on loading of a web page causes the same stress as people watching a horror movie. So, PWAs utilize service workers to optimize performance and provide a more responsive user experience. Also, allowing users to install your application on the home screen makes it faster to open and visit.
The transformation of the existing website into PWA is engineered to be as simple as possible. If you do not consider optimization (which I highly recommend), all you need is a manifest.json
file that is linked to the home page of your web app. But, if you want to optimize your web app, here are steps to do just that:
The web app manifest is a JSON file that provides essential information about your PWA, such as its name, icon, start URL, and display mode. This file is responsible for defining the overall behavior and appearance of your PWA, ensuring it behaves like a native app on the user's device.
Key elements of the web app manifest:
Here is an example of what a manifest.json
file looks like. Learn more here.
{
"short_name": "Sulav",
"name": "Sulav Blogs",
"icons": [ {...} ],
"id": "sulavpwa",
"start_url": "/",
"background_color": "#ffffff",
"display": "standalone",
"theme_color": "#ffffff"
}
A service worker is a JavaScript script that runs in the background, enabling offline functionality, push notifications, and improved performance. It acts as an intermediary between the PWA and the web, managing network requests, caching resources, and handling offline scenarios.
To ensure your PWA remains functional offline, it's crucial to identify and cache critical resources, such as HTML pages, JavaScript files, and CSS files. This involves analyzing the app's content and determining which elements are essential for providing a minimal yet usable experience even without an internet connection.
Improving the overall performance of your PWA is essential for providing a seamless and engaging user experience. This can be achieved through various techniques, such as code minification, image optimization, and content delivery networks (CDNs).
From my personal experience and things that I researched online, here are some of the best practices for creating exceptional PWA.
Here are some of the useful resources on the topic of Progressive Web Apps. Consider exploring these valuable resources:
By embracing the principles of PWA development and adhering to best practices, you can craft a web application that delivers a truly app-like experience, captivating users and enhancing their overall engagement. Remember, PWAs are not just about technology; they are about redefining the way users interact with the web.
4 mins to finish this blog.
1015 words read. Hooray!
Computer Science
Sulav Jung Hamal - 2024/08/20