为什么常识

浏览器敲网址按回车之后的各种技术细节都有什么?

生活词典 changshi.cidiancn.com

阅读: 279

浏览器敲网址按回车之后的各种技术细节都有什么?希望能尽可能详细深入的描述。我抛砖引玉一下,浏览器接收字符串,判断是哪种协议,调用操作系统API,操作系统找DNS服务器解析-(可能有缓存),向指定-发送请求,数据经过七层网络协议各种路由到达对方服务器(有可能传输失败),对方服务器给出响应,再传回来,浏览器收到数据(如HTML)后解释为用户友好的各种界面。4 个答案

答案 1:

Quote:T-ere’s no rig-t, or even complete, answer for t-is question. T-is question allows you to go into arbitrary amounts of detail depending on w-at you’re comfortable wit-. Here’s a start t-oug-:1. Browser contacts t-e DNS server to find t-e - address of URL.2. DNS returns back t-e - address of t-e site.3. Browser opens TCP connection to t-e web server at port 80.4. Browser fetc-es t-e -tml code of t-e page requested.5. Browser renders t-e HTML in t-e display window.6. Browser terminates t-e connection w-en window is closed.One of t-e most interesting steps is Step 1 and 2 - “Do-in Name Resolution.” T-e web addresses we type are not-ing but an alias to an - address in -u-n readable form. Mapping of do-in names and t-eir associated Internet Protocol (-) addresses is -naged by t-e Do-in Name System (DNS), w-ic- is a distributed but -ierarc-ical entity.Eac- do-in name server is divided into zones. A single server -y only be responsible for knowing t-e -ost names and - addresses for a -all subset of a zone, but DNS servers can work toget-er to -p all do-in names to t-eir - addresses. T-at means if one do-in name server is unable to find t-e - addresses of a requested do-in t-en it requests t-e infor-tion from ot-er do-in name servers.

答案 2:

判断协议直接取文本判断,然后调用API(不一定是系统API,还有可能是webkit之类)『操作系统找DNS服务器解析-(可能有缓存),向指定-发送请求,数据经过七层网络协议各种路由到达对方服务器』这部分应该是内核的功能,通过内核返回数据判断传输状况,解析数据包,排版,显示我也不是做这个的,这就是个大概,可能会有错误的地方。

答案 3:

楼上说的应该是大部分网络应用都会有的步骤,比如ftp,邮件之类的作为浏览器,主要的就是对-tml的渲染(浏览器内核)和javascript虚拟机吧

答案 4:

首先你要明白你输入的是什么:一般网址形式是aa://bb:cc/ aa代表使用网络协议,最常见的就是-ttp和-ttps以及ftp等,bb代表的是域名,cc代表的是端口号。由于你考虑的是浏览器,我就对-ttp来做个简单的说明,如果是-ttps等,就要复杂点。1 按下回车后,你的浏览器首先会去本地-osts查找对应域名的-地址,如果没有找到,那么将会连接到DNS服务器,获取该域名对应的-地址。2 浏览器获得-地址之后,将会向指定-,指定端口号(端口号缺省为80)的服务器建立TCP连接,不是UDP。3 连接建立之后,服务器将会返回相关页面的HTML文档,浏览器收到-tml文档之后,对-tml进行分析,由于-ttp协议是不连续的,因此对-tml中的什么图片连接,CSS连接等又要向服务器进行再次请求。所以我们用什么开发人员工具观察网络的时候,经常看到一次流浪过程中可能要请求几十个文件。4 对-tml进行渲染,执行javascript。5 连接不会关闭的,而是keep-alive,除非你自己指定关闭。这只是一个大概过程,浏览器把底层通讯等复杂操作封装了。

分享常识给亲友.

下一篇:哪里能找到详细的iPad绘画教程?想达到一定高度是否需要相当的绘画基础呢? 下一篇 【方向键 ( → )下一篇】

上一篇:知乎相比Quora,创新点在哪里? 上一篇 【方向键 ( ← )上一篇】