Comparison
Static and on-demand web pages
A static page can be generated ahead of a visit and served as prepared output. An on-demand page is rendered when a request arrives.
At a glance
- Static generation
- Prepare output before the request
- On-demand rendering
- Produce output when requested
Overview
A static page can be generated ahead of a visit and served as prepared output. An on-demand page is rendered when a request arrives. Frameworks can mix these approaches, letting the update frequency and personalization needs of each route shape its rendering strategy.
What differs
Prepared output can be reused without rerunning page generation for every visit. On-demand rendering can use request-time information, but its performance and availability depend on the runtime services involved.
Choose by the task
Use the content's change pattern and access rules to guide the choice. A public reference page and a personalized account page have different freshness and privacy requirements even within the same application.
Common confusion
A static page can contain interactive browser code, and an on-demand response can be cached. Rendering time, interactivity, and caching are related decisions rather than interchangeable labels.
Sources and review
MOOR's explanatory text is supported by the following source links.
- On-demand rendering — Astro
- Static and dynamic websites — MDN Web Docs