---
name: "up:link:preload"
area: "API"
kind: "DOM event"
parent: "up.link module"
url: "https://unpoly.com/api/up:link:preload"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.link module](https://unpoly.com/api/up.link.md)</nav>

# up:link:preload

This event is [emitted](https://unpoly.com/api/up.emit.md) before a link is [preloaded](https://unpoly.com/learn/preloading.md).

Listeners may prevent this event to stop the link from being preloaded or [change render options](https://unpoly.com/api/up:link:follow.md#changing-render-options) for the preload request.

<nav aria-label="Guides">

- [Learn: Preloading links](https://unpoly.com/learn/preloading.md)

</nav>

## Example {#example}

The following would disable preloading on slow 2G connections:

```js
function isSlowConnection() {
  // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
  return navigator.connection && navigator.connection.effectiveType.includes('2g')
}

up.on('up:link:preload', function(event) {
  if (isSlowConnection()) {
    event.preventDefault()
  }
})
```

---

## Event properties {#properties}

### event.target {#event.target}

(required)

The link element that will be preloaded.

Type: [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element)

### event.renderOptions {#event.renderOptions}

(required)

An object with [render options](https://unpoly.com/api/up.render.md#parameters) for the preloading.

Listeners may inspect or [modify](https://unpoly.com/api/up:link:follow.md#changing-render-options) these options.

Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects)

### event.preventDefault() {#event.preventDefault}

(required)

Prevents the link from being preloaded.

