There are two main ways to display web page content in a browser: Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
Essepage uses both methods together.
When you visit a page directly or refresh it, the server provides complete HTML using SSR. When you navigate to another page using a link within the site, the browser updates the necessary content using CSR.
What Is SSR?
SSR is a method in which the server generates the complete HTML for a page and sends it to the browser.
SSR is used in the following situations:
- Entering a page URL directly in the browser’s address bar
- Opening a page from a link on another website
- Opening a page from a bookmark
- Refreshing a page
Because an SSR page receives HTML that already contains its content, search engines can understand the page more easily.
What Is CSR?
CSR is a method that updates the browser screen by loading only the necessary content instead of requesting the entire document from the server again when navigating between pages.
In Essepage, CSR is used when a visitor follows a link to another page within the same site.
<a href="/about">About</a>When this link is selected, the browser URL changes to /about, and Essepage loads and displays the content of the new page.
Essepage structures a site as individual pages. During CSR navigation, it updates the page content displayed inside the <body>.
How Essepage Works
The rendering method can differ depending on how the visitor opens the page.
| Action | Rendering method |
|---|---|
| Visiting a page URL directly | SSR |
| Opening a link from another website | SSR |
| Refreshing the browser | SSR |
| Following an internal site link | CSR |
<head> and Global State
When a page is loaded through SSR or the browser is refreshed, a new document is loaded. A new JavaScript execution environment is also created, so existing variable values are reset.
During CSR navigation within the site, the browser does not reload the entire document or update the contents of <head>. Because the existing JavaScript execution environment is preserved, globally stored values can remain available while navigating between pages.
For example, you can define state shared across the site inside <head>.
<head>
<script>
window.siteState = {
menuOpen: false,
selectedTheme: "light"
};
</script>
</head>The values stored in window.siteState remain available while navigating through internal links with CSR.
window.siteState.selectedTheme = "dark";If you then navigate to another page, the value remains "dark" because the same JavaScript execution environment is preserved.
However, the value is reset when a new document is loaded, including in the following situations:
- Refreshing the page
- Entering a URL directly in the address bar
- Opening the page from a link on another website
- Opening the page in a new tab or window
This method is therefore suitable for temporarily preserving state during CSR navigation. If a value must remain available after refreshing or reopening the browser, use a separate storage method such as localStorage.
SSR creates a new document and JavaScript execution environment, while CSR updates the page content within the existing environment.
To learn more about page titles, descriptions, external scripts, and other <head> behavior, see Understanding <head>. For more information about managing values between pages, see Client-Side State.
If you use Alpine.js, you can also initialize a global store inside <head>. Its reactive state remains available during CSR navigation, making it easy to build an interactive site that shares state between pages.
Do I Need to Choose a Rendering Method?
In most cases, you do not need to choose between SSR and CSR yourself.
Create page files in Essepage and connect them using standard links, and the appropriate method is applied automatically.
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>When a page URL is visited directly, the page is displayed using SSR. When a visitor follows a menu link, the content is updated using CSR.
For standard homepages, blogs, documentation sites, and business websites, you can use this default behavior as it is.
Next Steps
Now that you understand the basic behavior of CSR and SSR, continue with the following guides:
- Learn how
<head>is handled during CSR navigation: Understanding<head> - Manage JavaScript state between pages: Client-Side State
- Connect site pages using links: Navigation and Links
- Call external APIs through the Essepage server: Proxy API
- Set page titles and descriptions: Metadata