I am studying the code of Tmall homepage, and I feel that its first-screen data does not look like it is loaded by ajax, so I would like to ask, how is its first-screen data loaded?
for example:
window.g_config.serverTime = 1496370628991; // "1496370628991"这个数字每次刷新都是变化的
<p id="J_defaultData" style="display:none;"> ………… </p> // 这个p(p中的json数据太长,所以省略了)里面的数据查看源代码的时候就有,并不像是ajax请求的。
The picture below is the data in p
After studying for an afternoon, I probably understand that the Tmall homepage is made using node on the server side, so the data will be brought in when the HTML is rendered. What you said above is correct. The data you get when you check the source code must be coming directly from the server.
Alibaba uses fetch technology to load, not ajax.
I haven’t researched it, but I guess it comes directly from the server
Template engine
Variable replacement
You can take a look at things related to server-side rendering. . In order to improve the rendering speed of the first screen. . Whether you use PHP or nodeJS, it can be rendered on the server side
https://developer.mozilla.org... fetch的API
I object to the fetch mentioned above, whether it is fetch or ajax. You can see the request being sent in the network, but obviously not on the home page.