Check out a free preview of the full Exploring Service Workers course

The "Offline Routing Q&A" Lesson is part of the full, Exploring Service Workers course featured in this preview video. Here's what you'd learn in this lesson:

Kyle fields questions about page reloads while in offline mode and dealing with request URLs with query parameters compared to ones without.

Preview
Close

Transcript from the "Offline Routing Q&A" Lesson

[00:00:00]
>> Student: If you reload the page, I'll see.
>> Kyle Simpson: Shift reload, doesn't work.
>> Student: Not shift reload cuz there's a hard reload.
>> Kyle Simpson: So the shift reload,
>> Kyle Simpson: Does work, I think I.
>> Kyle Simpson: I'm doing a double click. And I think that, there is a race condition with the service worker that's causing that cuz, I'm not doing anything else and then it's reloading.

[00:00:30]
So.
>> Kyle Simpson: But if you just do a shift reload, it reloads.
>> Kyle Simpson: Yes.
>> Student2: A small question. I see you went out of your way to use the URL property of the request object for the fetch.
>> Kyle Simpson: Yeap.
>> Student2: But then we just use the rec URL, variable in one of sorry, in the cash put the cash matches.

[00:01:03]
>> Kyle Simpson: Yeah.
>> Student2: That's because for the fetch we needed, we just wanted to be.
>> Kyle Simpson: In our case, it wouldn't matter.
>> Student2: Okay.
>> Kyle Simpson: But if your URL that you're sending off to the server had some query parameters on it, and you needed those to go to the server, then you want the full thing.

[00:01:21]
But I don't wanna put all those query parameters as my cache key, because query parameters are so volatile that I want to cache stuff at a main URL. So, there's some nuance there about what your requests look like. Remember you're literally programming a proxy. So you have 100% control that also means a 100% responsibility, to think about these styles and things you normally never think about.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now