This feature is experimental. Please share your experiences so we know what to keep or change.
The server can send this response header to force its response to open a new overlay.
The following will select the main element from the HTML payload
and open it with a basic modal
overlay:
Content-Type: text/html
X-Up-Open-Layer: {}
<html>
<main>
Overlay content
</main>
</html>
When X-Up-Open-Layer
is used without options, the new overlay will have the default mode (modal
), select a main target
and use default navigation options.
You can customize the target and appearance of the new overlay, by setting the header value to a relaxed JSON string with render options:
Content-Type: text/html
X-Up-Open-Layer: { target: '#menu', mode: 'drawer', animation: 'move-to-right' }
<div id="menu">
Overlay content
</div>
Many options from up.layer.open()
are supported. Options must be JSON-serializable.