From the course: JavaScript: Service Workers
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Implement a network-first policy - JavaScript Tutorial
From the course: JavaScript: Service Workers
Implement a network-first policy
- [Instructor] So, we have a project that is currently working offline even if we are online. Now, every time we refresh, we will see that the app is loaded immediately, so it has really good performance. That's because all the resources, or most of the resources, that are currently in the website, are coming from the local cache storage. If you press Shift Refresh, so if you press the shift key while you click on refresh, that's a normal load without service workers. You can see there is a difference with shift, and now without shift. Let's say that we want to change the color of these titles, like we don't like that color. So, if I right click, and inspect, we can see exactly the CSS selector that we need to change. It's main CSS at line 417. So, let's change that color. We go to main CSS, to that line, and we change the color. Let's say I want to change it with a red color. So, I'm saving the main CSS file, I'm going back to the browser, I'm refreshing, and I don't see any red…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Understand the new Cache API5m 36s
-
(Locked)
Prepare the project4m 30s
-
(Locked)
Prefetch files on install5m 1s
-
(Locked)
Visualize your cache3m 37s
-
(Locked)
Implement a cache-first policy6m 12s
-
(Locked)
Implement a network-first policy5m 10s
-
(Locked)
Cache new elements after install5m 41s
-
(Locked)
Use stale-while-revalidate6m 46s
-
(Locked)
Deliver alternate content when offline6m 28s
-
(Locked)
Keep your storage clean5m 28s
-
(Locked)
Summary of cache strategies4m 36s
-
-
-
-