The Evolution of Web Forms (Part 3): Redefining the Page Lifecycle
Article Abstract
As Web applications transition toward Single Page Applications (SPAs), page lifecycle management faces critical challenges such as navigation state synchronization and resource deallocation. While early AJAX technology achieved partial updates, PJAX caused prominent state pollution issues when synchronizing URLs via the History API because the page environment was not reset. With the widespread adoption of SPAs, the role of a page evolved from a browser loading unit into a continuously running environment, shifting lifecycle control from the browser to the internal application. Modern front-end frameworks rely on component-based architectures and state-driven mechanisms to establish dynamic synchronization between data and interfaces, effectively resolving pain points such as initialization dependencies on full page loads and lagging resource cleanup. While maintaining navigation consistency, this evolutionary path achieves flexible responses in complex interactive scenarios, ultimately building a multi-layered lifecycle system in which the browser's underlying environment and the application's self-management cooperate, providing technical support for dynamic content updates and state persistence.
Qwen3-14B · 2026-11-20

1 A Seemingly Ordinary Problem

As articles on the blog gradually accumulated, I felt more and more recently that the blog's built-in indexing features (tags, categories) were too weak to effectively showcase the connections between articles to visitors.

Therefore, I started trying to add new ways of organizing content for the blog, hoping to establish clearer connections between different articles through article series, knowledge indexes, and other methods, enabling visitors not only to read a single article but also to continue exploring related content by topic (for details, see: "Building a “Lightweight Knowledge Index” for Blogs”》)。

To improve the way blog content is organized, I added an article series navigation feature to the blog homepage, and also added right-side menus on article pages to display recommended categories and related articles—none of these features were fixed content written directly into the page HTML, but rather relied on JavaScript to dynamically generate after the page loaded.

At first, these features displayed properly when opening pages normally. But later I gradually noticed that their behavior seemed related to how the page was accessed: when I clicked on an article link on the homepage to enter the article page, the menus on the right that should have displayed recommended categories and related articles did not appear; and when I returned to the homepage via the browser's Back button, the right-side navigation menu for displaying article series also failed to load—the main content of the page appeared completely fine, but these parts dynamically generated by JavaScript were completely missing.

Strangely enough, simply refreshing the page would make the previously missing content reappear. This puzzled me: the page itself had not undergone any noticeable changes, nor had the code changed; the only difference was the way the page was accessed. According to user intuition, whether entering a page by clicking a link or refreshing the current page, the end result should be the same page, and the features on the page should remain consistent. But that was not the case, indicating that behind what users see, the browser might handle these two access methods differently. Upon further thought, I realized that behind this issue lies how the Web understands the concept of "opening a page."

In the past Web model, opening a page usually meant a complete page-loading process, and developers gradually formed a default understanding: opening a page means starting a new lifecycle, and much of the page interaction logic was built on this premise. However, as page access methods continually evolve, this originally stable premise is being broken: in some cases, the user sees a new page, but internally, the browser does not genuinely restart a page load.

So, I began to ponder a more fundamental question: for a browser, what is the actual difference between clicking a link to enter a new page, going back to a previously visited page, and refreshing the current page? Or from another angle: when users think they have entered a new page, has this page truly started afresh?

And behind this question is precisely the topic this article aims to discuss: the evolution of the Web page lifecycle.

2 The Browser's Original Page Model

For a long time, whether in the earliest simple static web pages or the later, more complex pages with CSS, JavaScript, and other capabilities gradually incorporated, the browser's understanding of "entering a page" never fundamentally changed: entering a page means starting a new page lifecycle.

When a user clicks a link, the browser leaves the current page, requests new page content, and creates a new page environment; when a user refreshes the current page, the browser also reloads it. Although these operations are just ordinary browsing actions for users, under the traditional page-loading model, they all required going through a complete page load.

Under this model, the page naturally became the fundamental unit of running a Web application, with page content, runtime state, and associated logic all attached to the page itself. This also fostered a stable programming habit among developers: execute the necessary initialization logic when the page loads, and when leaving the page, there is no need to specially consider carrying over the original state, because entering a page the next time usually means facing an entirely new runtime environment.


From how browsers create pages, to how pages carry content and runtime states, and to the programming habits developers formed as a result, the traditional Web page model actually encompasses three interconnected layers, the relationship of which is shown in the figure below:

image.png


This approach was fully reflected in the traditional Multi-Page Application (MPA) Web model: every time a page was switched, the browser would re-request the document, parse the HTML, and establish a new page environment—this is the most typical application scenario for a Full Reload (complete page reload). It was simple to implement, clear in behavior, and well satisfied the needs of the early Web.

But as web pages took on increasingly complex functionality, people began hoping to change this approach: if a user is only switching part of the content, is it truly necessary to reload the entire page? If what the user sees is new content, must the page necessarily restart from scratch?

3 The First Change: AJAX Stops the Page from Restarting Every Time

As the functions undertaken by web pages grew increasingly complex, the page model that had operated stably for a long time began facing new challenges.

Early web pages were mainly used to display information; users accessed pages, read content, and navigated to new pages—all of which could be accomplished through a full page load. However, as web pages gradually incorporated interactive features like search, form submission, and data updates, they began transforming from simple information displays into an application environment that needed to continuously respond to user actions.

In this situation, a new contradiction gradually emerged: a user's action might only affect part of the content on the page, yet the entire page had to reload as a result. For example, when updating search results, refreshing list data, or displaying new content based on user actions, other areas of the page often did not need to change. Having the entire page reload every time would not only increase waiting time but also disrupt an otherwise continuous operational flow.

Consequently, developers began trying to find a more flexible update method: could they directly fetch the required data without leaving the current page, and only update the parts of the page that changed? To achieve this effect, developers began trying to have web pages fetch data asynchronously from the server without leaving the current page, and then use JavaScript to dynamically update the page content based on the returned data. This technology was later known as AJAX (Asynchronous JavaScript and XML).

The real change brought about by AJAX was not just adding a method for asynchronously requesting data, but altering the previously tight coupling between page content updates and page navigation: in the past, displaying new content generally required reloading the entire page; now, the page could independently update its content while preserving the original runtime environment.


The differences between the page content update methods in the traditional page model and in AJAX mode are shown in the figure below:

image.png


For users, this change brought about a much more seamless interactive experience: pages would not reload over a simple action, and existing content and page state could be retained, updating only what truly changed. Web pages thus began to gradually offer a user experience akin to that of desktop applications.

However, while AJAX changed the way page content was updated, it also introduced a new problem: when a page can update its content without reloading, the browser's original navigation mechanisms can no longer automatically reflect these changes. For example, the URL does not automatically update as page content changes, and browser history does not automatically record these partial content switches. In other words, the browser is no longer aware of changes to page content. Developers were forced to rely on additional mechanisms to keep the content displayed on the page, the address recorded by the browser, and the user's actual browsing path consistent.

4 The Second Change: PJAX Begins to Decouple Page Navigation from the Lifecycle

To enable the browser to perceive changes in page content, developers began experimenting with proactively updating the browser URL and recording content transitions in the browser history, all while preserving AJAX's partial update capabilities. In this way, even without reloading the entire page, the browser could retain the corresponding navigation records, providing a foundation for forward, back, and other operations. This refreshless navigation method, which combines AJAX with the browser History API, is commonly referred to as PJAX (PushState + AJAX)。


The difference between traditional page navigation and PJAX page navigation is shown in the figure below:

image.png


From the user's perspective, this change was almost ideal: the page required no full reload, interactions remained smooth, the browser address bar updated alongside content switches, and actions such as forward, back, and bookmarking pages continued to work. The continuous experience brought by AJAX and the usage habits of traditional page navigation were preserved simultaneously. Looking only at this, it seemed that all problems had been solved.

However, the real issue was:PJAX changed the browser's navigation state, but it did not restart the page lifecycle. Although the URL and history were updated, the current page's JavaScript runtime environment remained unchanged, and the initialization logic that originally depended on a full page load would not automatically rerun due to this navigation.

This was precisely the root cause of the issue I encountered while developing new features for my blog: when navigating from the home page to an article page via PJAX, although the browser address changed, the “Related Categories” menu on the right side of the article—which relied on page initialization logic to generate—failed to appear. Similarly, when returning to the home page via the browser, the article series navigation menu on the right was not regenerated either. Only after genuinely refreshing the page and re-triggering the page loading process did these features return to normal.

Evidently, although PJAX re-established the connection between page content updates and browser navigation records, it also exposed a more fundamental problem:When a page no longer restarts with navigation, who should be responsible for the initialization, state management, and resource cleanup that originally relied on a full page load?

Note: For my blog, if I wanted to resolve this issue while keeping PJAX, I could listen for the PJAX navigation completion event, re-execute the relevant JavaScript initialization logic after the content switch, and clean up obsolete event listeners and runtime resources when necessary. However, this requires additional handling tailored to the dynamic features of different pages, increasing code complexity and maintenance costs. Considering that these menus do not hinder the normal reading of the main article content, I felt it unnecessary to spend the effort on this specific fix, so I temporarily left it as is.

5 When Pages Begin to Persist

Although the refreshless navigation represented by PJAX was initially intended merely to improve the page interaction experience, it actually altered the way traditional Web sites organized pages. As similar practices became widespread, developers began to realize: if a page does not have to be recreated with every navigation, could an entire website also be organized around a continuously running page environment?

In the past, a website was typically composed of many mutually independent pages. This approach of organizing a website based on multiple independent pages is commonly known as MPA (Multi-Page Application). In this model, every time a user visits a page, the browser usually restarts a new page lifecycle, making each page more like an independent document.

As pages were no longer recreated with each navigation, entire websites gradually began to exhibit another characteristic: a continuously running page environment hosts the entire application, while the content and interface seen by the user continuously evolve within it. Although users are still switching between different pieces of content, it feels more like completing different operations within the same application environment rather than repeatedly entering an entirely new document. It is precisely because of this that the Web began to gradually break through the traditional page organization model, taking on increasingly prominent application-like characteristics.

Later, this paradigm—based on a continuously running front-end application that accomplishes all website interactions through dynamic switching of content and interfaces—came to be known as SPA (Single Page Application).

The “single page” here does not mean the website has only one page, nor does it mean the user always remains on the same piece of content. What “single page” truly emphasizes is that the entire application is typically based on a continuously running page environment, with subsequent navigation and interface transitions primarily handled by front-end programs. The different pages seen by the user are, in essence, different interfaces presented by the same application under different states, rather than requiring the browser to reload a complete HTML document every time.


The differences between MPA and SPA are shown in the figure below:

image.png


By this point, the Web had begun to evolve from websites composed of multiple independent pages into continuously running applications. Throughout this process, the role played by the page on the Web also transformed—in the past, within the traditional multi-page model, a page was usually the fundamental unit created and loaded by the browser; now, a page is more like a long-lived runtime environment, where what truly changes continuously are the data, content, and interface within it.

From Full Reload to AJAX, and then to PJAX, the Web gradually broke the originally tight coupling between page content updates, browser navigation, and page lifecycle. With SPAs, this change further extended to how the entire application is organized: pages are no longer merely documents loaded and displayed by the browser, but have become the foundational environment hosting application runtime, state management, and user interface interactions.

However, a new question also emerged: since pages now persist long-term, who should be responsible for the initialization, state restoration, and resource management that previously relied on page reloads?

6 Applications Begin to Manage Their Own Lifecycle

When pages began to persist long-term, lifecycle management issues changed accordingly. The initialization, state restoration, and resource management tasks that once depended on page reloads now needed to be reorganized throughout the continuous running of the page.

In such a continuously running page environment, many constantly changing parts can exist simultaneously within a single page. For example, one region might need to display new content based on user actions, another region might need to update data, and temporarily created UI elements—such as modals or dropdown menus—need to be destroyed promptly when no longer in use, releasing associated resources. These changes no longer occur centrally during a single complete page load, but are dispersed across various stages of the page's continuous runtime.

Thus, lifecycle management began to expand from the page as a whole to the various components within the page. When a UI element is created, updated, or destroyed; how data within it synchronizes with changes in application state; and when resources like event listeners or timers created during UI runtime should be cleaned up—all need to be explicitly managed. If developers still rely entirely on manually handling these changes, the relationships between the internal parts of the page become increasingly complex as the application scale grows.

Consequently, modern front-end frameworks and their related technical ecosystems began to take on new responsibilities. The problem they solve is not merely providing a more convenient development approach, but helping developers establish a mechanism to organize and manage internal application changes within a continuously running page environment.

Under this model, developers no longer need to directly write DOM manipulation code for every UI change as they did traditionally. Instead, by describing the application state and the relationship between state and UI, they let the framework coordinate UI updates based on state changes. As a result, the UI is no longer just a document that developers must continually modify by hand, but has gradually become a dynamic view driven by application state.


In modern front-end applications, close connections exist between application state, UI components, and runtime resources; together, they constitute the internal lifecycle management mechanism of the application, as shown in the diagram below:

image.png


Later, modern front-end frameworks represented by React and Vue gradually became crucial foundations for building such applications. Through componentization, reactive updates, and corresponding state management mechanisms, they help developers break down complex UIs into relatively independent components and coordinate their creation, updating, and destruction throughout the application's continuous runtime.

At this point, the way the Web page lifecycle was managed changed once again. In the traditional page model, the browser was responsible for creating and loading the page, offering developers opportunities for initialization and cleanup through page lifecycle events. As pages evolved into applications, lifecycle management penetrated deeper into the application itself: developers define the application's state and behavior, while frameworks help manage the creation, updating, and destruction of components. The browser remains responsible for providing the foundational environment for the page to run, while the application takes on the responsibility of managing its own internal changes.

7 Redefining the Web Page Lifecycle

Looking back at the evolution of the Web as a whole, what truly changed was not just how pages are loaded, but also the Web's very understanding of what a “page” is.

Initially, a page was primarily a document served by a server and loaded and displayed by a browser, with its lifecycle revolving around a single complete page visit. But as the Web evolved, the page shifted from being the outcome of a single load into an environment that can run continuously. Content and interfaces can change dynamically within it, users can perform various operations without reloading the page, and applications can run continuously in this environment. Therefore, today's Web pages can no longer be simply understood as static HTML documents; rather, they have evolved into application runtime environments that host data, state, and user interactions.

At the same time, the scope of lifecycle management has continually expanded. In the past, developers primarily organized code around the browser's page loading and unloading processes. Now, within a continuously running page, there are also application state changes, UI component creation, updates, and destructions, as well as the registration and cleanup of runtime resources like event listeners and timers. Lifecycle management no longer focuses solely on when the entire page begins and ends; it must also handle the distinct runtime processes of different components within the application.

From this perspective, AJAX, PJAX, SPAs, and the modern front-end technology ecosystem, while addressing issues at different levels, jointly drove the evolution of how Web pages operate: from content updates and browser navigation to application architecture and internal lifecycle management, developers have gradually gained more flexible control, no longer needing to tie every change to a complete page reload.

Ultimately, the management of Web page lifecycles underwent a major shift: expanding from revolving mainly around the browser's page loading and unloading processes into a multi-layered management system involving the browser, the application, and its internal components. The browser remains responsible for providing the foundational runtime environment for the page, while the application must manage its own state, UI, and related resources.

This is also one of the most critical differences between today's Web and the early Web: while users still see individual pages, behind those pages can now lie an application system that runs continuously and changes constantly.

📚 Series Article: The Evolution of Web Forms (3 / 3)

View Related Categories · 3 Matches
📌 Content Structure Prompt:
This content is part of the following knowledge map, where you can view the complete content path: Blog Knowledge Map。
📎 Related Articles
Share this article
The blog content is original, please indicate the source when reposting! The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if needed, you can join theTelegram Groupto discuss questions together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗ
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Kaomoji
Emoji
Little Dinosaur
Flower!
Previous
       

👋 Welcome to “Wudi's Personal Blog”

Here, long-term exploration is mainly carried out around the following directions:

🧱 Personal Digital Infrastructure and Blog System Construction
☁️ Cloudflare and Network Architecture Practice
🧠 AI and Knowledge System Exploration
🛡️ Network Security and Access Optimization
🎵 Music and Sound Cognition
👁️ Cognitive Perspectives and Worldviews