When I press <== back
button in the browser, what is going on?
unchanged
then local cache is used?I am unclear because of those situations:
My opinion is that querying again would be the best idea, but it is not the fastest, and browser may want to be fast in that case (to impress the user)... On the other hand, storing page states must cost a lot of memory...
In javascript, navigation type 2 means browser's back or forward button clicked and the browser is actually taking content from cache. This doesn't work on a single page application, the result is always 1 (which means reload).
Going back is not the same as "undo". You may be looking at stale information without realizing it. The "Back" concept is fine for static content, but falls apart when dealing with dynamic content, such as data entry, dynamic queries, etc.
Browser initiates TCP connection with the server. Browser sends the HTTP request to the server. Server processes request and sends back a response. Browser renders the content.
Script preventing you from going back If neither of the previous sections resolved your issue, you have encountered deliberate, poor, or malicious code. Some websites add code to their pages that prevent users from using the back button to leave their pages or site.
It depends.
It depends on HTTP request method. If the page was GET the browser may decide to cache it, and not re-request. POST and other HTTP methods are not cached as they may have side effects server side. This is why you even get a warning dialog if you go back to a page that was loaded by a POST request.
It depends on caching headers. (See here) Pages that are explicitly allowed to be cached as described in their header may be reused when navigated back to.
It depends on the browser. Some have optimized heavily for user experience (more caching, more speed, more staleness). Where others are simpler and simply re-request the page.
It depends on memory usage, especially on mobile devices. The browser may decide not to keep the page content and state if the page is large or there isn't a lot of available memory.
Browsers are complicated pieces of software, and smart people having been working to optimize them for a very long time.
As far as what level of caching is used for back navigation, I think there are three primary levels
(this is probably an oversimplication, but it'll give you the general idea.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With