---
name: "up:layer:location:changed"
area: "API"
kind: "DOM event"
parent: "up.layer module"
url: "https://unpoly.com/api/up:layer:location:changed"
---
<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:location:changed

This event is emitted after a layer's [location property](https://unpoly.com/api/up.Layer.prototype.location.md) has changed value.

This event is _also_ emitted when a layer [without visible history](https://unpoly.com/api/up.Layer.prototype.history.md) has reached a new location. If you are only interested in changes that are visible in the browser's address bar, observe [`up:location:changed`](https://unpoly.com/api/up:location:changed.md) instead.

The event is also emitted for location changes on the [root layer](https://unpoly.com/learn/overlays.md#layer-modes).

This event is _not_ emitted when an overlay is opened. For this, observe [`up:layer:opened`](https://unpoly.com/api/up:layer:opened.md) instead.

<nav aria-label="Guides">

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

</nav>

---

## Event properties {#properties}

### event.location {#event.location}

(required)

The current layer location.

Type: string

### event.previousLocation {#event.previousLocation}

(required)

The previous layer location.

May be `undefined` if the layer was opened without a known location.

Type: string | undefined

### event.layer {#event.layer}

(required)

The [layer object](https://unpoly.com/api/up.Layer.md) that had its location changed.

Type: [up.Layer](https://unpoly.com/api/up.Layer.md)

