简体   繁体   中英

How does gmail and facebook change the URL path without having to change the entire HTML DOM?

Gmail and Facebook is able to change the URL where you can still use the back and forward buttons but the page's HTML DOM doesn't change fully. How are they doing this? I know they are using javascript, but what other technologies are involved in this magic?

这是通过History API完成的。

The trick behind the libraries and components they use is AJAX (Asynchronous Javascript and XML). It's a way of getting information in JS without having to reload the page.

They use the History API to change the URL and AJAX to update part of the site content.

Twitter has implemented this to their site as well, they explained it in detail on this Twitter Blog

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