> For the complete documentation index, see [llms.txt](https://pwa.spomky-labs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pwa.spomky-labs.com/the-service-worker/workbox/navigation-preload.md).

# Navigation Preload

Navigation Preload is a feature that speeds up navigation requests by allowing the browser to make network requests in parallel with service worker boot-up. Without Navigation Preload, the browser must wait for the service worker to start before making network requests, which can introduce latency.

## How It Works

When a user navigates to a page:

1. **Without Navigation Preload**: Browser waits for the service worker to start → Service worker makes the network request → Response is returned
2. **With Navigation Preload**: Browser starts the service worker AND makes the network request simultaneously → Faster response

This can significantly improve perceived performance, especially on devices where service worker startup is slow.

## When to Use Navigation Preload

Navigation Preload is beneficial when:

* Your service worker uses a **NetworkFirst** or **NetworkOnly** strategy for navigation requests
* You are **not** precaching HTML pages
* You want to reduce the latency introduced by service worker startup

## When NOT to Use Navigation Preload

{% hint style="warning" %}
**Do not enable Navigation Preload if you are precaching HTML pages.** If you're using `offline_fallback` with a page fallback or `preload_urls` to warm cache HTML pages, Navigation Preload would be redundant and may cause unnecessary network requests.
{% endhint %}

This is why Navigation Preload is **disabled by default** in this bundle.

## Configuration

To enable Navigation Preload:

{% code title="/config/packages/pwa.yaml" lineNumbers="true" %}

```yaml
pwa:
    serviceworker:
        enabled: true
        src: "sw.js"
        workbox:
            navigation_preload: true
```

{% endcode %}

## Browser Support

Navigation Preload is supported in modern browsers including Chrome, Edge, and Opera. Firefox and Safari do not currently support this feature, but Workbox handles this gracefully by falling back to standard behavior.

## Further Reading

* [Workbox Navigation Preload Documentation](https://developer.chrome.com/docs/workbox/modules/workbox-navigation-preload/)
* [Speed up Service Worker with Navigation Preloads](https://web.dev/navigation-preload/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://pwa.spomky-labs.com/the-service-worker/workbox/navigation-preload.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
