Edit this page

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

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

Upon seeing the header, Unpoly will cancel the fragment update and accept 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 acceptance 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 accept the targeted overlay with the value {user_id: 1012 }:

Content-Type: text/html
X-Up-Accept-Layer: {"user_id": 1012}

<html>
  ...
</html>

Rendering content

The response may contain text/html content. If the root layer is targeted, the X-Up-Accept-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:

Content-Type: text/html
X-Up-Accept-Layer: {"user_id": 1012}
X-Up-Target: :none