---
title: "Warmup Strategy · Nuxt Scripts"
description: "Customize the preload or preconnect strategy used for your scripts."
canonical_url: "https://scripts.nuxt.com/docs/guides/warmup"
meta:
  "og:description": "Customize the preload or preconnect strategy used for your scripts."
  "og:image": "https://scripts.nuxt.com/_og/s/o_57a95c6ca5107837.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Warmup Strategy · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_57a95c6ca5107837.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Guides**

# **Warmup Strategy**

[Copy for LLMs](https://scripts.nuxt.com/docs/guides/warmup.md)

## Background

Nuxt Scripts can insert a warmup `**<link>**` before a deferred script loads. Consider this script:

```ts
useScript('/script.js')
```

`**/script.js**` uses the default `**onNuxtReady**` trigger. While Nuxt hydrates, Nuxt Scripts adds a low-priority preload to the document head:

```html
<link rel="preload" href="/script.js" as="script" fetchpriority="low">
```

Automatic warmup applies to the `**client**` and `**onNuxtReady**` [**script triggers**](https://scripts.nuxt.com/docs/guides/script-triggers). Change it with `**warmupStrategy**`.

These strategies map to the browser's [**preload and connection-warming hints**](https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/Speculative_loading). Keep them selective: preloading every deferred script makes the hints compete with the resources needed for the current page.

## `**warmupStrategy**`

`**warmupStrategy**` accepts:

- `**false**`: Disable warmup.
- `**'preload'**`: Preload the script. Use this when the script will load immediately.
- `**'preconnect'**` or `**'dns-prefetch'**`: Warm up the script's origin. These values work only for cross-origin scripts; same-origin scripts do not receive a link tag.

## `**warmup**`

Call `**warmup()**` directly when application state tells you a manual script will probably load soon:

```ts
const script = useScript('/video.js', {
  trigger: 'manual'
})
// Start downloading when the video enters the viewport
onVisible(videoContainer, () => {
  script.warmup('preload')
})
// Execute after a click
onClick(videoContainer, () => {
  script.load()
})
```

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/1.guides/1.warmup.md)

[Markdown For LLMs](https://scripts.nuxt.com/docs/guides/warmup.md)

[**Script Triggers** Control when Nuxt Scripts starts loading a script.](https://scripts.nuxt.com/docs/guides/script-triggers) [**First-Party Mode: Privacy-Focused Proxy** Route third-party script traffic through a reverse proxy on your domain with automatic anonymization.](https://scripts.nuxt.com/docs/guides/first-party)

**On this page **

- [Background](#background)
- [warmupStrategy](#warmupstrategy)
- [warmup](#warmup)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/docs/guides/warmup#webpage","@type":"WebPage","description":"Customize the preload or preconnect strategy used for your scripts.","name":"Warmup Strategy","url":"https://scripts.nuxt.com/docs/guides/warmup","breadcrumb":{"@id":"https://scripts.nuxt.com/docs/guides/warmup#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/docs/guides/warmup"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/docs/guides/warmup#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Documentation","item":"https://scripts.nuxt.com/docs","position":2},{"@type":"ListItem","name":"Guides","item":"https://scripts.nuxt.com/docs/guides","position":3},{"@type":"ListItem","name":"Warmup Strategy","item":"https://scripts.nuxt.com/docs/guides/warmup","position":4}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
