loading...
Cover image for What is a PWA and why you should know about it
daily.dev

What is a PWA and why you should know about it

thisisgarv profile image Garv Nanwani Originally published at daily.dev ・3 min read

Have you ever wondered how you can convert your webpage to an app that can run on a mobile phone no matter its Android or iOS?

Or have you seen that little + (plus) icon at the top of a website, and it makes you wonder how this website is installable? Well, PWA is the answer to your questions.

What is PWA?

PWA's or Progressive Web Apps are a hybrid or say a mix of your regular websites or web pages and a mobile application; they provide you the power of both worlds. And PWA's are getting quite popular these days a significant reason being you don't need to learn another language like Kotlin or flutter to build a mobile app for your product, you can convert your existing website into a mobile application. You can even submit to Google Play and App store.
Of course, you can't compete with a language specifically designed for mobile apps, but still, PWA's come in handy a lot of time, you don't have to code separately for android, ios and browsers.
PWA's have access to all native app features like local storage, cache, push notifications, offline access, and a lot of cool features, so if all this gets you excited, let's dive deeper into it.

Benefits of PWA

Cross Platform Support

PWA is browser build and not os build so it can run on any machine, whether it is Android, ios, or your laptop.

Speed

PWA is quite faster compared to your standard websites because of the use of service workers, which helps to store the contents of the website in the form of cache on the first time load, making all your further loads significantly faster.

Offline Mode

That's the biggest feature standard websites lack, but through the use of service workers, you can load an offline version of your app, or you can cache the data for the first time and provide it for the later loads giving a better user experience.

SEO Friendly

In simple words, SEO is a way to make your websites get ranked higher in the search page results, e.g., Google. So, because PWA is technically a website, its content can get indexed and are discoverable on search engines, and because of this, your app can reach a broader audience.

Low cost of development

You don't need to hire a web developer and an app developer separately for your project, and you can convert your existing website to a PWA in no time.

And a lot of others.

Yes, there are quite a few disadvantages of using a PWA like the browser compatibility issues and the inability to control all features of mobile phones fully, but still, its plus points kind of pay off for all its costs.

Okay, So enough talk now, let's see what the things that make up a PWA are.

  • A manifest.json file: This is a JSON file which contains all the information about how your app will look, which initial page to load when your app starts, all the icons which the app should use and it also tells the browser that it's a PWA and how it should behave after being installed.

  • A service worker: A service worker is just a javascript file that runs as soon as your app loads and keeps running in the background. It helps you to control all the network requests, push notifications, cache items, etc.. In short, this script takes care of all the functionality part of your app and thus is the core of any PWA.

  • A secure HTTPS connection: As, by now, you must have realized PWA's are highly robust, so they only work on trusted connections, to make sure there is no harm to user's data and overall security, and in general to user experience.

That's it, add these three features to your code, make sure to connect the manifest and service worker file to your HTML. You are good to go. Most browsers detect that your app is a PWA and they give an option of installing it to the home screen when a user visits your site, else you can generate a .apk file for it and publish it to the well known PWA Store or the App Store.

PWA is a vast topic in itself. There's a lot more to it, but for getting started, these three things are essential, and rest your curiosity will figure it out by itself.


daily.dev delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.
Daily Poster

Posted on by:

thisisgarv profile

Garv Nanwani

@thisisgarv

Full Stack Web developer looking for new projects and collab. Tools I use are mostly React and Django

Discussion

pic
Editor guide
 

I agree with Chris, I like to learn new things related to PWA I was very surprised when I found out that PWA uses Forbes, Pinterest, Twitter, by the way, it's a pity that they did not write about it, I read this information here cleveroad.com/blog/how-to-build-a-... it seems that the Instagram site also works on PWA

 

Even twitter uses PWA for its desktop app and it saw a large growth with the use of PWA, many big companies use PWA as an alternative for desktop apps as it copies the same functionality as the website

 

PWA, Is a very easy wat to get started in making your first mobile experience.
I think they are very powerful and might even overtake hybrids

 

Yeah, I totally agree.
They even solve the problem of having seperate app for Android and iOS, it makes the process quite easy and comfortable.