简体   繁体   中英

How facebook, twitter reload their page without any refresh?

I am so much curious about this technology, I want to know how Facebook, Twitter, and many websites reload their page after clicking on a link without any refreshing?

I search about this on google but did not find any helpful information, In this Quora article . Someone says that they use WebSocket API or AJAX to request anything like that.

So, What this technique/ technology name?

Mostly all modern websites are powered with FE frameworks like React, Angular, Vue and many others the main feature of which is dynamically construct DOM in response to user actions without the need of page reload.

One of the the power tool of these specific frameworks are routers. That pretty much reconstruct the page from the blueprint stored on FE side

Please have a look on the working demo of React Router: https://codesandbox.io/s/nn8x24vm60

PS: Pretty much JS hides/removes specific elements in the DOM and replaces them with the expected ones when user navigates using specific router links (which can look like normal link for other developer inspects DOM, unless you really inspect attached Event Listeners)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM