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

# [up-layer=new]

Shows the response to a link click or form submission within [a new overlay](https://unpoly.com/learn/opening-overlays.md).

<nav aria-label="Guides">

- [Learn: Opening overlays](https://unpoly.com/learn/opening-overlays.md)

</nav>

## Example {#example}

This link will open its response in a modal overlay:

```html
<a href="/menu" up-layer="new">Open menu</a>
```

This form will show error messages from a [failed submission](https://unpoly.com/learn/error-responses.md) within a modal overlay:

```html
<form action="/submit" up-fail-layer="new">
  ...
</form>
```

---

## Modifying attributes {#attributes}

> #### Info
>
> All modifying attributes for [`[up-follow]`](https://unpoly.com/api/up-follow.md) (links) or [`[up-submit]`](https://unpoly.com/api/up-submit.md) (forms) can also be used.
> Default layer attributes can be configured in [`up.layer.config`](https://unpoly.com/api/up.layer.config.md).

### Placement {#attributes-placement}

#### [up-target] {#up-target}

(optional)

The selector of the root content element to place inside the overlay container.

The target must be matchable within the HTML provided by either the `[href]`, `[up-content]`, `[up-fragment]`, or `[up-document]` attribute.

If the attribute is omitted, Unpoly will use the first matching [main target](https://unpoly.com/api/up-main.md) configured for the overlay mode. For example, the default selectors for modals are configured in `up.layer.config.modal.mainTargets`. See [main targets in overlays](https://unpoly.com/api/up-main.md#overlays).

#### [up-layer="new"] {#up-layer}

(optional)

Whether to stack the new overlay or replace existing overlays.

The following values are supported:

| Option | Description |
| --- | --- |
| `new` | Stacks a new overlay over the current layer. |
| `swap` | Replaces the current overlay. If no overlay is open, opens an overlay. |
| `shatter` | Closes all overlays and opens a new overlay. |

Type: string

#### [up-position] {#up-position}

(optional)

For **popups**, the position of the popup relative to the link or button that opened the overlay. See [popup position](https://unpoly.com/learn/customizing-overlays.md#popup-position).

For **drawers**, the screen edge on which to position the drawer (`left` or `right`). See [drawer position](https://unpoly.com/learn/customizing-overlays.md#drawer-position).

Type: string

#### [up-align] {#up-align}

(optional)

For **popups**, the alignment of the popup within its `{ position }`. See [popup position](https://unpoly.com/learn/customizing-overlays.md#popup-position).

Type: string

### Request {#attributes-request}

#### [href] {#href}

(optional)

The URL to fetch from the server.

See [loading content from a URL](https://unpoly.com/learn/providing-html.md#url).

To use a different URL when a link is followed through Unpoly (as opposed to a browser's full page load), set an [`[up-href]`](https://unpoly.com/api/up-href.md) attribute.

Instead of making a server request, you may also render an [existing string of HTML](https://unpoly.com/learn/providing-html.md#string).

#### [up-method='get'] {#up-method}

(optional)

The HTTP method to use for the request.

Common values are `get`, `post`, `put`, `patch` and `delete`. The value is case-insensitive.

The HTTP method may also be passed as a `[data-method]` attribute.

By default, methods other than `get` or `post` will be converted into a `post` request, and carry their original method as a configurable [`_method` parameter](https://unpoly.com/api/up.protocol.config.md#config.methodParam).

#### [up-params] {#up-params}

(optional)

A [relaxed JSON](https://unpoly.com/api/relaxed-json.md) object with additional [parameters](https://unpoly.com/api/up.Params.md) that should be sent as the request's [query string](https://en.wikipedia.org/wiki/Query_string) or payload.

When making a `GET` request to a URL with a query string, the given `{ params }` will be added to the query parameters.

#### [up-headers] {#up-headers}

(optional)

A [relaxed JSON](https://unpoly.com/api/relaxed-json.md) object with additional request headers.

Unpoly will by default send a number of custom request headers. For example, the [`X-Up-Target`](https://unpoly.com/api/X-Up-Target.md) header includes the [target selector](https://unpoly.com/learn/targeting-fragments.md). See [`up.protocol`](https://unpoly.com/api/up.protocol.md) for details.

#### [up-abort='target'] {#up-abort}

(optional)

Whether to abort existing requests before rendering.

By default, opening a new overlay will abort all requests within the [main](https://unpoly.com/api/main.md) element of its base layer.

See [aborting requests](https://unpoly.com/learn/aborting-requests.md) for details and a list of options.

#### [up-abortable='true'] {#up-abortable}

(optional)

Whether the request may be aborted by other requests.

By default, the request will be aborted:

- By another request opening another overlay from the same base layer
- By another request targeting the base layer's [main](https://unpoly.com/api/main.md) element

See [Preventing a request from being aborted](https://unpoly.com/learn/aborting-requests.md#preventing).

#### [up-background='false'] {#up-background}

(optional)

Whether this request will load in the background.

Background requests are deprioritized and won't show the [progress bar](https://unpoly.com/learn/progress-bar.md). See [Background requests](https://unpoly.com/learn/background-requests.md).

#### [up-late-delay] {#up-late-delay}

(optional)

The number of milliseconds after which this request can cause an [`up:network:late`](https://unpoly.com/api/up:network:late.md) event.

Defaults to [`up.network.config.lateDelay`](https://unpoly.com/api/up.network.config.md#config.lateDelay).

#### [up-timeout] {#up-timeout}

(optional)

The number of milliseconds after which this request fails with a timeout.

Defaults to [`up.network.config.timeout`](https://unpoly.com/api/up.network.config.md#config.timeout).

#### [up-fail] {#up-fail}

(optional)

Whether to render [error responses](https://unpoly.com/learn/error-responses.md) differently.

For error responses Unpoly will use attributes prefixed with `up-fail`, e.g. [`[up-fail-target]`](https://unpoly.com/api/up-follow.md#up-fail-target).

By [default](https://unpoly.com/api/up.network.config.md#config.fail) any HTTP status code other than 2xx or [304](https://unpoly.com/learn/conditional-requests.md#rendering-nothing) is considered an error code. Set `[up-fail=false]` to handle _any_ response as successful, even with a 4xx or 5xx status code.

### Local content {#attributes-local-content}

#### [up-content] {#up-content}

(optional)

The new [inner HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) for the targeted fragment.

See [Updating an element's inner HTML from a string](https://unpoly.com/learn/providing-html.md#content).

Instead of passing an HTML string you can also [pass a template selector](https://unpoly.com/learn/templates.md), optionally with [variables](https://unpoly.com/learn/placeholders.md#dynamic-templates).

#### [up-fragment] {#up-fragment}

(optional)

A string of HTML comprising _only_ the new fragment's [outer HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML).

With an `[up-fragment]` attribute you can omit the `[up-target]` attribute. The target will be [derived](https://unpoly.com/learn/target-derivation.md) from the root element in the given HTML.

See [Rendering a string that only contains the fragment](https://unpoly.com/learn/providing-html.md#fragment).

Instead of passing an HTML string you can also [pass a template selector](https://unpoly.com/learn/templates.md), optionally with [variables](https://unpoly.com/learn/placeholders.md#dynamic-templates).

#### [up-document] {#up-document}

(optional)

A string of HTML containing the targeted fragment.

See [Extracting an element's outer HTML from a larger HTML string](https://unpoly.com/learn/providing-html.md#document).

Instead of passing an HTML string you can also [pass a template selector](https://unpoly.com/learn/templates.md), optionally with [variables](https://unpoly.com/learn/placeholders.md#dynamic-templates).

### Customization {#attributes-customization}

#### [up-mode='modal'] {#up-mode}

(optional)

The kind of overlay to open.

Defaults to [`up.layer.config.mode`](https://unpoly.com/api/up.layer.config.md#config.mode), which defaults to `'modal'`.

See [available layer modes](https://unpoly.com/learn/overlays.md#layer-modes).

#### [up-size='medium'] {#up-size}

(optional)

The size of the overlay.

See [overlay sizes](https://unpoly.com/learn/customizing-overlays.md#overlay-sizes) for details.

#### [up-class] {#up-class}

(optional)

An optional HTML class for the overlay's container element.

See [overlay classes](https://unpoly.com/learn/customizing-overlays.md#overlay-classes).

#### [up-dismissible] {#up-dismissible}

(optional)

How the overlay can be [dismissed](https://unpoly.com/learn/closing-overlays.md) by the user.

See [customizing dismiss controls](https://unpoly.com/learn/customizing-overlays.md#customizing-dismiss-controls) for details.

You can enable multiple dismiss controls by separating values with a space or comma character.

Passing `true` or `false` will enable or disable all dismiss controls.

### Client state {#attributes-client-state}

#### [up-use-data] {#up-use-data}

(optional)

The [data object](https://unpoly.com/learn/data.md) for the overlay's root content element (`[up-target]`), encoded as [relaxed JSON](https://unpoly.com/api/relaxed-json.md).

If the content element already has an [`[up-data]`](https://unpoly.com/api/up-data.md) attribute, properties from `[up-use-data]` take precedence.

#### [up-context] (Experimental) {#up-context}

(optional)

The new overlay's [context](https://unpoly.com/api/up.layer.context.md) object, encoded as [relaxed JSON](https://unpoly.com/api/relaxed-json.md).

### History {#attributes-history}

#### [up-history='auto'] {#up-history}

(optional)

Whether the overlay has [visible history](https://unpoly.com/learn/history-in-overlays.md).

If set to `'true'`, the overlay location, title, and meta tags will be shown while the overlay is open. When the overlay is closed, the parent layer's history is restored.

If set to `'auto'`, history will be visible if the initial overlay content matches a [main target](https://unpoly.com/api/up-main.md).

If set to `'false'`, fragment changes within the overlay will _never_ update the address bar. You can still access the overlay's current location using [`up.layer.location`](https://unpoly.com/api/up.layer.location.md).

See [History in overlays](https://unpoly.com/learn/history-in-overlays.md).

#### [up-fail-history='auto'] {#up-fail-history}

(optional)

Whether to update history when the server responds with an error code.

See [Rendering error responses differently](https://unpoly.com/learn/error-responses.md#fail-options).

#### [up-title] {#up-title}

(optional)

An explicit document title to set before rendering.

By default the title is extracted from the response's `<title>` tag. To prevent the title from being updated, set `[up-title=false]`.

This attribute is only used when [updating history](#up-history).

#### [up-location] {#up-location}

(optional)

An explicit URL to set before rendering.

By default Unpoly will use the link's `[href]` or the final URL after the server redirected. To prevent the URL from being updated, set `[up-location=false]`.

This attribute is only used when [updating history](#up-history).

#### [up-meta-tags] {#up-meta-tags}

(optional)

Whether to update [meta tags](https://unpoly.com/api/up-meta.md) in the `<head>`.

By default Unpoly will extract meta tags from the response's `<head>`. To prevent meta tags from being updated, set `[up-meta-tags=false]`.

This attribute is only used when [updating history](#up-history).

#### [up-lang] {#up-lang}

(optional)

An explicit language code to set as the [`html[lang]`](https://www.tpgi.com/using-the-html-lang-attribute/) attribute.

By default Unpoly will extract the language from the response and update the `html[lang]` attribute in the current page. To prevent the attribute from being changed, set `[up-lang=false]`.

This attribute is only used when [updating history](#up-history).

### Animation {#attributes-animation}

#### [up-animation='fade-in'] {#up-animation}

(optional)

The [name](https://unpoly.com/learn/animations.md#available-animations) of the opening animation.

#### [up-easing='ease'] {#up-easing}

(optional)

The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function) that controls the opening animation's acceleration.

#### [up-duration='175'] {#up-duration}

(optional)

The duration of the opening animation in milliseconds.

#### [up-close-animation='fade-out'] {#up-close-animation}

(optional)

The [name](https://unpoly.com/learn/animations.md#available-animations) of the closing animation.

#### [up-close-easing='ease'] {#up-close-easing}

(optional)

The [timing function](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function) that controls the closing animation's acceleration.

#### [up-close-duration=175] {#up-close-duration}

(optional)

The duration of the closing animation in milliseconds.

### Close conditions {#attributes-close-conditions}

#### [up-accept-event] {#up-accept-event}

(optional)

An event type that will cause this overlay to automatically be [accepted](https://unpoly.com/learn/closing-overlays.md) when a matching event occurs within the overlay.

The [acceptance value](https://unpoly.com/learn/closing-overlays.md#acceptance-values) is the event object that caused the overlay to close.

You can listen to multiple event types by separating types with a space or comma.

See [Closing when an event is emitted](https://unpoly.com/learn/subinteractions.md#event-condition).

#### [up-dismiss-event] {#up-dismiss-event}

(optional)

An event type that will cause this overlay to automatically be [dismissed](https://unpoly.com/learn/closing-overlays.md) when a matching event occurs within the overlay.

The [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) is the event object that caused the overlay to close.

You can listen to multiple event types by separating types with a space or comma.

See [Closing when an event is emitted](https://unpoly.com/learn/subinteractions.md#event-condition).

#### [up-accept-location] {#up-accept-location}

(optional)

One or more space-separated [URL patterns](https://unpoly.com/api/url-patterns.md) that will cause this overlay to automatically be [accepted](https://unpoly.com/learn/closing-overlays.md) when the overlay reaches a matching [location](https://unpoly.com/api/up.layer.location.md).

The [acceptance value](https://unpoly.com/learn/closing-overlays.md#acceptance-values) is an object of [named segments matches](https://unpoly.com/api/url-patterns.md#capturing-named-segments) captured by the URL pattern. It also contains the matched URL as a `location` key.

See [Closing when a location is reached](https://unpoly.com/learn/subinteractions.md#location-condition).

#### [up-dismiss-location] {#up-dismiss-location}

(optional)

One or more space-separated [URL patterns](https://unpoly.com/api/url-patterns.md) that will cause this overlay to automatically be [dismissed](https://unpoly.com/learn/closing-overlays.md) when the overlay reaches a matching [location](https://unpoly.com/api/up.layer.location.md).

The [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) is an object of [named segments matches](https://unpoly.com/api/url-patterns.md#capturing-named-segments) captured by the URL pattern. It also contains the matched URL as a `location` key.

See [Closing when a location is reached](https://unpoly.com/learn/subinteractions.md#location-condition).

#### [up-accept-fragment] {#up-accept-fragment}

(optional)

A CSS selector that will cause this overlay to automatically be [accepted](https://unpoly.com/learn/closing-overlays.md) when a matching element is observed within the overlay.

The [acceptance value](https://unpoly.com/learn/closing-overlays.md#acceptance-values) is the matching fragment's [data](https://unpoly.com/learn/data.md) object.
If the fragment has no data, the value is an empty object.

See [Closing when a fragment is detected](https://unpoly.com/learn/subinteractions.md#fragment-condition).

#### [up-dismiss-fragment] {#up-dismiss-fragment}

(optional)

A CSS selector that will cause this overlay to automatically be [dismissed](https://unpoly.com/learn/closing-overlays.md) when a matching element is observed within the overlay.

The [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) is the matching fragment's [data](https://unpoly.com/learn/data.md) object.
If the fragment has no data, the value is an empty object.

See [Closing when a fragment is detected](https://unpoly.com/learn/subinteractions.md#fragment-condition).

### Callbacks {#attributes-callbacks}

#### [up-on-opened] {#up-on-opened}

(optional)

A JavaScript snippet that is called when the overlay was inserted into the DOM.

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link that opened the overlay |
| `layer` | An [`up.Layer`](https://unpoly.com/api/up.Layer.md) object for the new overlay |
| `event` | An [`up:layer:opened`](https://unpoly.com/api/up:layer:opened.md) event |

#### [up-on-accept] {#up-on-accept}

(optional)

A JavaScript snippet that is called when the overlay is about to be [accepted](https://unpoly.com/learn/closing-overlays.md).

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link that originally opened the overlay |
| `layer` | An [`up.Layer`](https://unpoly.com/api/up.Layer.md) object for the closing overlay |
| `value` | The overlay's [acceptance value](https://unpoly.com/learn/closing-overlays.md#acceptance-values) |
| `response` | The server response that is causing the overlay to close |
| `event` | An [`up:layer:accept`](https://unpoly.com/api/up:layer:accept.md) event |

To keep the overlay open, call `event.preventDefault()`. This has no effect when the overlay is closed because a background layer is being [updated](https://unpoly.com/learn/closing-overlays.md#peeling).

To run code after the overlay closed, use `[up-on-accepted]` instead.

#### [up-on-accepted] {#up-on-accepted}

(optional)

A JavaScript snippet that is called when the overlay was [accepted](https://unpoly.com/learn/closing-overlays.md).

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link that originally opened the overlay |
| `layer` | An [`up.Layer`](https://unpoly.com/api/up.Layer.md) object for the accepted overlay |
| `value` | The overlay's [acceptance value](https://unpoly.com/learn/closing-overlays.md#acceptance-values) |
| `response` | The server response that caused the overlay to close |
| `event` | An [`up:layer:accepted`](https://unpoly.com/api/up:layer:accepted.md) event |

To only reload an element, use `[up-on-accepted-reload]` instead.

#### [up-on-accepted-reload] (Experimental) {#up-on-accepted-reload}

(optional)

A selector to [reload](https://unpoly.com/api/up.reload.md) after the overlay was [accepted](https://unpoly.com/learn/closing-overlays.md).

The element is looked up in the layer that opened the overlay. An element near the link is preferred, and the selector may use [`:origin`](https://unpoly.com/api/origin.md) to refer to the link.

Unlike `[up-on-accepted]`, this attribute runs no JavaScript, so it needs no [CSP nonce](https://unpoly.com/learn/script-security.md#callback-nonces). When both attributes are set, the `[up-on-accepted]` callback runs first.

See [Subinteractions: Reloading on acceptance](https://unpoly.com/learn/subinteractions.md#reloading-on-acceptance).

#### [up-on-dismiss] {#up-on-dismiss}

(optional)

A JavaScript snippet that is called when the overlay is about to be [dismissed](https://unpoly.com/learn/closing-overlays.md).

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link that originally opened the overlay |
| `layer` | An [`up.Layer`](https://unpoly.com/api/up.Layer.md) object for the closing overlay |
| `value` | The overlay's [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) |
| `response` | The server response that is causing the overlay to close |
| `event` | An [`up:layer:dismiss`](https://unpoly.com/api/up:layer:dismiss.md) event |

To keep the overlay open, call `event.preventDefault()`. This has no effect when the overlay is closed because a background layer is being [updated](https://unpoly.com/learn/closing-overlays.md#peeling).

To run code after the overlay closed, use `[up-on-dismissed]` instead.

#### [up-on-dismissed] {#up-on-dismissed}

(optional)

A JavaScript snippet that is called when the overlay was [dismissed](https://unpoly.com/learn/closing-overlays.md).

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link that originally opened the overlay |
| `layer` | An [`up.Layer`](https://unpoly.com/api/up.Layer.md) object for the dismissed overlay |
| `value` | The overlay's [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) |
| `response` | The server response that caused the overlay to close |
| `event` | An [`up:layer:dismissed`](https://unpoly.com/api/up:layer:dismissed.md) event |

To only reload an element, use `[up-on-dismissed-reload]` instead.

#### [up-on-dismissed-reload] (Experimental) {#up-on-dismissed-reload}

(optional)

A selector to [reload](https://unpoly.com/api/up.reload.md) after the overlay was [dismissed](https://unpoly.com/learn/closing-overlays.md).

The element is looked up in the layer that opened the overlay. An element near the link is preferred, and the selector may use [`:origin`](https://unpoly.com/api/origin.md) to refer to the link.

Unlike `[up-on-dismissed]`, this attribute runs no JavaScript, so it needs no [CSP nonce](https://unpoly.com/learn/script-security.md#callback-nonces). When both attributes are set, the `[up-on-dismissed]` callback runs first.

#### [up-confirm] {#up-confirm}

(optional)

A message the user needs to confirm before any request or changes are made.

The message will be shown as a [native confirmation dialog](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm).

If the user does not confirm, no request is sent and no fragments are updated.

The message may also be passed as a `[data-confirm]` attribute, as rendered by Rails helpers like `link_to` or `button_to`.

See [Confirmation dialogs](https://unpoly.com/learn/confirmation-dialogs.md), also for showing a styled dialog instead of the browser's.

#### [up-on-loaded] {#up-on-loaded}

(optional)

A JavaScript snippet that is executed when the server responds with new HTML, but before the HTML is rendered.

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link being followed |
| `event` | A preventable [`up:fragment:loaded`](https://unpoly.com/api/up:fragment:loaded.md) event |

The snippet will also run for [error responses](https://unpoly.com/learn/error-responses.md).

#### [up-on-offline] {#up-on-offline}

(optional)

A JavaScript snippet that is executed when the fragment could not be loaded due to a [disconnect or timeout](https://unpoly.com/learn/network-issues.md).

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link being followed |
| `event` | An [`up:fragment:offline`](https://unpoly.com/api/up:fragment:offline.md) event |

To try again, call `event.retry()`.

#### [up-on-rendered] {#up-on-rendered}

(optional)

A JavaScript snippet that is executed when Unpoly has updated fragments.

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link being followed |
| `result` | The [`up.RenderResult`](https://unpoly.com/api/up.RenderResult.md) for the respective render pass |

The snippet will be called zero, one or two times:

- When the server rendered an [empty response](https://unpoly.com/learn/conditional-requests.md#rendering-nothing), no fragments are updated. `[up-on-rendered]` is not called.
- When the server rendered a matching fragment, it will be updated on the page. `[up-on-rendered]` is called with the [result](https://unpoly.com/api/up.RenderResult.md).
- When [revalidation](https://unpoly.com/learn/caching.md#revalidation) renders a second time, `[up-on-rendered]` is called again with the final result.

Also see [Running code after rendering](https://unpoly.com/learn/render-lifecycle.md#running-code-after-rendering).

#### [up-on-finished] {#up-on-finished}

(optional)

A JavaScript snippet that is executed when no further DOM changes will be caused by this render pass.

The following state is considered "finished":

- [Animations](https://unpoly.com/api/up.motion.md) have concluded and [transitioned](https://unpoly.com/api/up-transition.md) elements have been removed from the DOM tree.
- [Async compilers](https://unpoly.com/api/up.compiler.md#async) have settled.
- [Cached content](https://unpoly.com/learn/caching.md) has been [revalidated with the server](https://unpoly.com/learn/caching.md#revalidation).
  If the server has responded with fresher content, that content has also been rendered.

The snippet runs in the following scope:

| Expression | Value |
| --- | --- |
| `this` | The link being followed |
| `result` | The [`up.RenderResult`](https://unpoly.com/api/up.RenderResult.md) for the last render pass that updated a fragment |

If [revalidation](https://unpoly.com/learn/caching.md#revalidation) re-rendered the fragment, `result` describes updates from the second render pass. If no revalidation was performed, or if revalidation yielded an [empty response](https://unpoly.com/learn/caching.md#when-nothing-changed), it is the result from the initial render pass.

To run a snippet after an [error response](https://unpoly.com/learn/error-responses.md) has finished rendering, set an `[up-on-fail-finished]` attribute instead.

Also see [Awaiting post-processing](https://unpoly.com/learn/render-lifecycle.md#postprocessing).

#### [up-on-error] {#up-on-error}

(optional)

A JavaScript snippet that is run when any error is thrown during the rendering process.

| Expression | Value |
| --- | --- |
| `this` | The link being followed |
| `error` | An [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object |

The callback is also called when the render pass fails due to [network issues](https://unpoly.com/learn/network-issues.md) or [aborts](https://unpoly.com/learn/aborting-requests.md).

Also see [Handling errors](https://unpoly.com/learn/render-lifecycle.md#handling-errors).

