question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Works Offline" should simulate a navigation request

See original GitHub issue

The “works offline” audit currently performs the following:

const requestPage = function() {
  const oReq = new XMLHttpRequest();
  oReq.onload = oReq.onerror = e => {
    // __returnResults is injected by driver.evaluateAsync
    __returnResults(e.currentTarget.status);
  };
  oReq.open('GET', '');
  oReq.send();
};

Some service worker implementations (like the one sw-precache uses) have logic in place to detect whether the incoming fetch event is associated with a Request whose mode is set to 'navigate', and take specific action when that’s the case—like falling back to a cached Response representing the App Shell, allowing them to work offline.

I understand that using an XMLHttpRequest is much easier to script than properly triggering a navigation request, though. (Even if the code used fetch(), it’s not possible to construct a Request with mode set to 'navigate'.) Maybe there’s something that could be done with creating an <iframe> and checking whether that loads properly? Or else scripting a navigation to the same URL and then detecting if that is successful? Any thoughts on those approaches?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
paullewiscommented, Jun 13, 2016

@jeffposnick Do you fancy giving that PR a go?

0reactions
wardpeetcommented, Jul 27, 2016

i’m up for this one as well, no rush 😃 @jeffposnick

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling navigation requests - web.dev
Navigation requests are requests for HTML made whenever you enter a new URL in the navigation bar, or follow a link on a...
Read more >
Offline capability - Pega
The standard Pega 7 app from the app store will not work in offline mode. See Mobile settings reference. You can also simulate...
Read more >
Does Chrome have a "Work Offline" option? - Stack Overflow
Now, a device and network bandwidth and latency (or completely offline) can be simulated using the dropdowns at the top of the screen:....
Read more >
angular/pwa navigationUrls for simulated offline fetch request ...
Adding / to navigationUrls in the ngsw-config.json should return the index.html page but it fails ... Site cannot be installed: Page does not...
Read more >
Temporarily simulate being offline programmatically
A general solution for Windows is to run an application (such as Mathematica) inside a Sandboxie sandbox, for which Sandbox Settings ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found