Gets the current environment the rendering process is running in.

When possible, the rendering process is split in two in order to improve performance. The first cycle in the process happens in the server-side code and the second cycle happens in the client-side code. If not possible on the server-side, all rendering happens client-side.

The env property returns "backend" when rendering on the server and "browser" when rendering on the client.

Use the env property in your page's onReady() event handler to control where your code runs during the rendering process and to prevent code that causes side effects from running twice.

Note: Rendering never occurs server-side when previewing your site.

Was this helpful?