---
name: "up.Preview.prototype.openLayer"
area: "API"
kind: "Instance method"
parent: "up.Preview class"
visibility: "experimental"
url: "https://unpoly.com/api/up.Preview.prototype.openLayer"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Preview class](https://unpoly.com/api/up.Preview.md)</nav>

# up.Preview.prototype.openLayer()

**This feature is experimental**. Please [share](https://github.com/unpoly/unpoly/discussions) your experiences so we know what to keep or change.

Opens a temporary overlay.

When the preview ends, the overlay will be [dismissed](https://unpoly.com/learn/closing-overlays.md) with a [dismissal value](https://unpoly.com/learn/closing-overlays.md#dismissal-values) of `":undo-preview"`.

When the user dismisses the temporary overlay before the server responds, the previewed request will be [aborted](https://unpoly.com/learn/aborting-requests.md).

When previewing a render pass that is going to [open an overlay](https://unpoly.com/learn/opening-overlays.md), the temporary overlay will use the same [visual style](https://unpoly.com/learn/customizing-overlays.md) and animations.

## Example {#example}

This preview opens a temporary overlay with a loading message:

```js
up.preview('spinner-overlay', function(preview) {
  preview.openLayer('Please wait...')
})
```

