window.history.back()

By medeb | personalblog | 15 Jun 2025


1. window.history.back()

This is an excellent question that gets to the heart of how single-page applications (SPAs) like those built with Angular work, as opposed to traditional multi-page applications.

Using window.history.back() (or simply the browser's "Back" button) in an Angular project can sometimes leave the page in a state that appears "not loaded" or broken.

2. Multi-Page Applications (MPAs): In a traditional application, each navigation (link click, back button) asks the browser to load a new, complete HTML page from the server. The browser downloads the HTML, CSS, and JavaScript associated with this new page and then displays it. window.history.back() simply asks the browser to reload the previous page in its history (often from the cache or via a new request).
3. Single-Page Applications (SPAs): An Angular application only loads a single initial HTML page (index.html). All internal navigation within the application is handled by Angular's router. The router intercepts clicks, changes the URL in the address bar (without a full page reload), and dynamically updates the page content by displaying the Angular component corresponding to the new URL.

91b8854740ced988a5867ffe1d6cb2ed55f0c47b682dc74b162e7678eed2d7ce.png

How do you rate this article?

3



personalblog
personalblog

My daily experience in crypto world

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.