How does Twitter show my profile instantly?

Context

I realized that on Twitter, the profile page is displayed differently depending on how it is called:

  • By clicking on the profile link in the menu, the DOM and the latest tweets are loaded, and the page is displayed in ~ 4 seconds. Everytime.
  • Using a keyboard shortcut GP(or link on the left), the page is displayed instantly.

More details

  • I noticed that the profile that was supposed to be displayed recently for GPinstantly displays the page.
  • Closing and opening the browser, the profile should be displayed again for GP, which instantly displays the page.

Study

So, at first I thought that Twitter could use a server session variable to store data. Then I discovered the use of localStorage in the Twitter source code. I admit, DOM storage is a stranger to me, and the Twitter JavaScript code is unreadable. So I'm not sure if they use localStorage to store the profile.

Question

Any hypothesis, information, or links about a DOM repository / repository for storing a DOM?

+5
source share
1 answer

This is an interesting question, so I went on Twitter and made an investigation myself.

When I click on my profile name, the link is executed using AJAX. I see my timeline loading. But the page is already loaded in advance, so my information is also already loaded.

GP, ( JavaScript, ). , , AJAX (JSON).

URL- https://twitter.com/#!/ https://twitter.com/#!/wraldpyk ( ).

( ), https://twitter.com/wraldpyk. . , https://twitter.com/#!/wraldpyk, ( FireBug , )

, ( JavaScript, ), . .

, gh . ( )

+5

All Articles