# Week 9 - IndexedDB & Service Workers
# IndexedDB
Similar to MongoDB, IndexedDB is a document style database. However, this is a database that exists inside the browser and is accessible only to the client who is viewing the website being rendered by the browser. This data is not accessible outside the browser by other browsers, servers, or users.
Think of IndexedDB as temporary storage like LocalStorage
. On an iOS device, if the website is NOT running as an installed app (added to the Home Screen), then the localstorage, sessionstorage, cached files and indexedDB data will all be deleted after 7 - 14 days of inactivity.
Learn more about IndexedDB API
# Service Workers
Service Workers are similar to Web Workers. They are a script that needs to be registered by the main script of your website. Then they take responsibility for all interactions between your website and all web servers.
Service workers act like a proxy server by intercepting requests to the server and deciding how to handle each request. They have full access to the Fetch API
and so can send their own requests to the server.
They have the ability to cache assets through the Cache API
.
They have the ability to save data through the IndexedDB API
.
They also have the ability to send and receive messages between itself and any number of tabs or windows from the same domain on the client's machine.
Service Workers can be added to ANY website. You don't have to be building a PWA to use a Service Worker.
Learn more about Service Workers
TODO
- Read the content and watch the videos for Week 9.
- Watch the video series on IndexedDB
- Watch the video series on Service Workers
- Review the 3rd Project - PWA