Is a web app able to store anything locally to speak of? ie. What if anything will load without an internet connection, and can that be a changed or is it essentially nothing more than a website bookmark essentially built to behave like an app?

Genuine curious, I don’t really know the distinction exactly.

Reply to this note

Please Login to reply.

Discussion

Also indexeddb

Good intel Ben, thx!

PWA's can be specially configured to cache assets for use offline. Not sure if you ever experienced this but Twitter desktop is able to load the UI while offline, just the content doesnt load obviously.

Yes, they can, but it's stupidly slow and shitty as hell.

Can it be improved?

I copied and pasted your note into my friend ChatGPT. I thought It will not stop outputing πŸ˜† my answer would be much shorter which is "Yes" πŸ˜ƒ

-----------------------------

A web app can indeed store data locally using web storage technologies. There are two main methods for local data storage in web apps:

1. **Web Storage (localStorage and sessionStorage):** These are mechanisms provided by web browsers that allow web apps to store data on the user's device. localStorage provides persistent storage, meaning the data will persist even when the browser is closed and reopened. sessionStorage, on the other hand, provides temporary storage that is available only for the duration of the browser session.

2. **IndexedDB:** IndexedDB is a more advanced local storage option available in modern web browsers. It is a NoSQL database that allows web apps to store large amounts of structured data locally. IndexedDB provides more advanced querying and indexing capabilities compared to web storage.

With these local storage mechanisms, web apps can store and retrieve data such as user preferences, cached content, or even offline data for use when there is no internet connection. This allows web apps to provide a better user experience by functioning even when offline or with limited connectivity.

Regarding the distinction between a web app and a native app, a web app is essentially a website that is designed and built to behave like a traditional desktop or mobile app. It is accessed through a web browser and can run on different devices and platforms without the need for separate codebases. Web apps are typically built using web technologies such as HTML, CSS, and JavaScript, and can be bookmarked or added to the home screen for easy access. However, they still require an internet connection to load the app code and fetch data from remote servers, although certain parts of the app can be designed to work offline using local storage as mentioned above. Native apps, on the other hand, are specifically built for a particular platform (e.g., iOS, Android) and are usually downloaded and installed from an app store. Native apps have direct access to the device's hardware and can offer more extensive functionality compared to web apps, but they require separate development efforts for each platform.

The storage API and indexDB are available as places to store application-specific data (as previously mentioned).

The other key browser API for PWAs is service workers. https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers

These are JavaScript workers that are allowed to run independently of the document and respond to network requests on a given origin (essentially acting as the server for offline use cases).