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"這個數(shù)字每次刷新都是變化的
<p id="J_defaultData" style="display:none;"> ………… </p> // 這個p(p中的json數(shù)據(jù)太長,所以省略了)里面的數(shù)據(jù)查看源代碼的時候就有,并不像是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.
I haven’t researched it, but I guess it comes directly from the server
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
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.