javascript - Isn't the response body of http request all html? It can also be css, pictures, js, etc.?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-19 10:47:38
0
5
676

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?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(5)
淡淡烟草味

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.

迷茫

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.

左手右手慢动作

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

phpcn_u1582

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.

过去多啦不再A梦

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template