Edit this page

up.protocol X-Up-Dismiss-Layer
HTTP header

The server may set this response header to dismiss the targeted overlay in response to a fragment update.

Upon seeing the header, Unpoly will cancel the fragment update and dismiss the layer instead. If the root layer is targeted, the header is ignored and the fragment is updated with the response's HTML content.

The header value is the dismissal value serialized as a JSON object. To accept an overlay without value, set the header value to the string null.

Important

HTTP headers may only contain US-ASCII (7-bit) characters. If you have higher code points in a JSON value, you may encode those characters using Unicode escape sequences.

Example

The response below will dismiss the targeted overlay without a dismissal value:

HTTP/1.1 200 OK
Content-Type: text/html
X-Up-Dismiss-Layer: null

<html>
  ...
</html>

Rendering content

The response may contain text/html content. If the root layer is targeted, the X-Up-Dismiss-Layer header is ignored and the fragment is updated with the response's HTML content.

If you know that an overlay will be closed and don't want to render HTML, have the server change the render target to :none:

HTTP/1.1 200 OK
Content-Type: text/html
X-Up-Dismiss-Layer: {"user_id": 1012}
X-Up-Target: :none