In the web Gmail interface navigation letters done in the following way:
Initially, we visit Inbox
Click on a letter and get on
This opens the letter itself.
As you can see, we work through the "grid"
#, so the page is reloaded, not proishodt, instead, go "the anchor". However, the URL changes and the browser makes the transition without sending a request to the server, resulting in instantly opens the text of the letter (which is already stored in the DOM via JS and displays to the user) and becomes available to the Back button in the browser, obviously. If pressed, we return to the message list, the text of the letter thus concealed, of course without reloading the page, and it is very fast.
Question: How does it work? Specifically, after clicking "Back". We are working on the same page, you need to somehow close an open letter. How does this mechanism work? What is the event processed? I hope the essence of the issue is clear.