search

Home  >  Q&A  >  body text

javascript - Isn't the response body of http request all html? It can also be css, pictures, js, etc.?

Doesn’t every request return html? Pictures, js, css are not included in html?
Or if the html in an address request contains an image, is it considered two requests?

曾经蜡笔没有小新曾经蜡笔没有小新2770 days ago682

reply all(5)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:49:38

    The content_type of http has the following form

    Text: Text information used for standardized representation. Text messages can be in multiple character sets and or multiple formats;

    Multipart: used to connect multiple parts of the message body to form a message. These parts can be different types of data;

    Application: used to transmit application data or binary data;

    Message: used to wrap an E-mail message;

    Image: used to transmit static image data;

    Audio: used to transmit audio or sound data;

    Video: Used to transmit dynamic image data, which can be a video data format edited together with audio.

    You can specify the resource type.
    A single operation can only be counted as one request.

    reply
    0
  • 迷茫

    迷茫2017-05-19 10:49:38

    You open the browser developer tools, select network, refresh, and you can see all the requests.

    When you open a website, the browser will parse the src attribute and generate a new get request. It is the picture you mentioned.

    reply
    0
  • ringa_lee

    ringa_lee2017-05-19 10:49:38

    You can understand it this way, everything is a resource. Intuitively, you can map any URL (including relative URL) that appears to a resource, so a document includes pictures. Don’t these pictures all have the src attribute? This is URL, each resource corresponds to a type, that is, the MIME type. As long as the server is willing to provide it and the client (browser) can parse it, there is no problem

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-19 10:49:38

    http is a transmission protocol. In theory, it can transmit any data (packaged-packaged). The specific legend is actually determined based on the request and response.
    In order to facilitate the client to parse the obtained data, the series content_type is defined (after negotiation, declaration, and everyone’s approval), as mentioned on the first floor. But this is just a declarative method, and you can break through it when developing specific applications. For example, although you declare it as text, the transmitted data may be base64-encoded binary data.

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:49:38

    Basically all data types can be converted into binary data streams, so basically they can be transmitted.

    reply
    0
  • Cancelreply