zoukankan      html  css  js  c++  java
  • 浏览器如何解析服务器端发送的HTML文件

    我一直为一个问题困惑,当我明白了以后,又不知道该怎么去说我要问的问题,现在我明白了,就把它帖出来,也不知道其他人遇到这个问题的时候,搜索的关键字能不能搜到,呵呵

     首先客户端发送请求:http://localhost:8080/index.html。实际上发送的数据是:

    GET /index.html HTTP/1.1
    Accept: */*
    Accept-Language: en,zh-cn;q=0.5
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (MSIE 7.0; MSIE 7.0; Windows NT 5.1; InfoPath.1)
    Host: localhost:8080

    Connection: Keep-Alive



    然后服务端把index.html文件发送给客户端:

    <html>
    <head>
    <title>Welcome to BrainySoftware</title>
    </head>
    <body>
    <img src="./images/logo1.gif">
    <br>
    Welcome to BrainySoftware.
    <br>
    <img src="./images/logo.gif">
    <br>
    Welcome to BrainySoftware.
    </body>

    </html>

    接下来客户端解析index.html 文档,当他解析到特殊标签<img 的时候,向服务短发送请求:

    GET /images/logo1.gif HTTP/1.1
    Accept: */*
    Referer: http://localhost:8080/index.html
    Accept-Language: en,zh-cn;q=0.5
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (MSIE 7.0; MSIE 7.0; Windows NT 5.1; InfoPath.1)
    Host: localhost:8080

    Connection: Keep-Alive

     服务端把图片在发送给客户端。

    然后当他解析到新的特殊标签<img 的时候,再次发送请求:

    GET /images/logo.gif HTTP/1.1
    Accept: */*
    Referer: http://localhost:8080/index.html
    Accept-Language: en,zh-cn;q=0.5
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (MSIE 7.0; MSIE 7.0; Windows NT 5.1; InfoPath.1)
    Host: localhost:8080

    Connection: Keep-Alive

     服务端把图片在发送给客户端。

    如此往复,把整个文档显示出来,呵呵原创啊!好了,就这么多

    保国


  • 相关阅读:
    在MathType如何让括号随内容自动调整大小的技巧
    对于MathType中公式与文字错位的问题怎么解决
    怎样批量修改MathType公式格式
    你与论文达人只差一个MathType的距离
    公式达人必杀技,你会几招?
    如何用MathType快速输入公式
    openfire数据库mysql配置
    thinkphp 操作mssql2008
    phpstudy+php5.2+mssql2008
    thinkphp openfire 添加用户 骨架
  • 原文地址:https://www.cnblogs.com/baoguo/p/1318425.html
Copyright © 2011-2022 走看看