输入URL网址到页面渲染(Enter URL URL to page rendering)

从一个url地址到最终页面渲染完成,发生了什么?1.DNS解析:将域名地址解析为ip地址    -浏览器DNS缓存    -系统DNS缓存    -路由器DNS缓存   -网络运营商DNS缓存    -递归搜索:blog.baidu.com             -.com域名下查找DNS解析             -.baidu域名下查找DNS解析             -blog域名下查找DNS解析             -出错了2.TCP连接,三次握手     -第一次握手,由浏览器发起,告诉服务器我要发送请求了     -第二次握手:由服务器发起的,告诉服务器我准备接受了,你赶紧发送吧     -第三次握手,由浏览器发起的,告诉服务器,我马上就发了,你准备接受吧3.发送请求       -请求报文:Http协议的通信内容4.接受响应      -响应报文5.渲染页面      -遇见html标记,浏览器调用HTML解析器解析成Token并构建成DOM树      -遇见style/link标记,浏览器调用CSS解析器,处理CSS标记并构建CSSOM树      -遇见script标记,调用javascript解析器,处理script代码(绑定事件,修改DOM树……)      -将DOM树和CSSOM树合并成一个渲染树      -根据渲染树来计算布局,计算每个节点的几何信息(布局)      -将各个节点的颜色绘制到屏幕上(渲染)      注意:这个五个步骤不一定按照顺序执行,如果DOM树和CSSOM树被修改了,可能会执行多次布局和渲染,往往实际页面中,这些步骤都会执行多次。

6.断开连接:TCP四次挥手      -第一次挥手:由浏览器发起的,发送给服务器,我东西发送完了(请求报文),你准备关闭      -第二次挥手,由服务器发起的,告诉浏览器,我东西接收完了(请求报文),我准备关闭了,你也准备吧     -第三次挥手:由服务器发起,告诉浏览器,我东西发送完了(响应报文),你准备关闭吧     -第四次挥手:由浏览器发起,告诉服务器,我东西接受完了(响应报文),你准备关闭吧,你也准备吧

————————

< strong > what happens from a URL address to the final page rendering 1. DNS resolution: resolves a domain name address to an IP address     – Browser DNS cache     – System DNS cache     – Router DNS cache    – Network operator DNS cache     – Recursive search: blog.baidu.com              -. DNS resolution under COM domain name              -. Search DNS resolution under Baidu domain name              – Search DNS resolution under blog domain name              – Error 2. TCP connection, three handshakes      – The first handshake was initiated by the browser and told the server that I was going to send a request      – The second handshake: it is initiated by the server. Tell the server that I am ready to accept it. Please send it quickly      – The third handshake is initiated by the browser. Tell the server that I will send it immediately. Are you ready to accept it? 3. Send the request        – Request message: communication content of HTTP protocol 4. Accept response       – Response message 5. Rendering page       – When encountering HTML tags, the browser calls the HTML parser to parse them into tokens and construct a DOM tree       – When meeting the style / link tag, the browser calls the CSS parser, processes the CSS tag and constructs the cssom tree       – When encountering the script tag, call the JavaScript parser and handle the script code (binding events, modifying the DOM tree…)       – Merge the DOM tree and cssom tree into a render tree       – Calculate the layout according to the rendering tree and calculate the geometric information (layout) of each node       – Draw the color of each node to the screen (render)        Note: these five steps are not necessarily executed in order. If the DOM tree and cssom tree are modified, layout and rendering may be performed many times. Often, these steps will be performed many times in the actual page.

6. Disconnect: TCP waves four times       – Wave for the first time: it is initiated by the browser and sent to the server. My things have been sent (request message). Are you ready to close       – The second wave is initiated by the server. Tell the browser that I have received my things (request message). I’m ready to close it. Are you ready      – The third wave: initiated by the server, tell the browser that my things have been sent (response message). Are you ready to close it      – The fourth wave: initiated by the browser, tell the server that I have accepted my things (response message). You are ready to close it, and you are also ready