Front-end small problems

js interview question understanding

The front-end interviews are endless. As long as you want to ask questions, you can come up with anything, but their test points will not change. You only need to master the key points on the outside.

1. What happened when the url was sent to the page load

Can be divided into several aspects

  1. Process:
    1. DNS resolution (resolve the domain name and resolve the corresponding IP address)
    2. TCP connection (three-way handshake in the tcp connection)
    3. Send an http request
    4. Process the request and return data
    5. Render the page
    6. The connection ends

There is also understanding of three handshake and four back hands

  1. Three-way handshake (before connection establishment)
    1. The first handshake: the client sends a connection request segment to the server;
    2. The second handshake: after the server receives the connection request segment, it will send if it agrees to connect Response;
    3. The third handshake: After the client receives the connection agreement response, it sends a confirmation message segment to the server to indicate receipt

  2. Waves four times (before disconnection)
    1. Wave for the first time: If the client thinks that the data transmission is complete, it needs to send a connection release request to the server.
    2 Waves for the second time: After the server receives the request for connection release, The corresponding application will be notified, telling it that the client's connection to the server in this direction has been released
    3, the third wave: when the server sends all the data to the client, it sends a connection release request to the client
    4, fourth Waves once: After the client receives the release request, it sends a confirmation response to the server

The difference between Http and Https

Different ports: Http and Https use different connection methods, and the ports are also different;
Resource consumption: Compared with HTTP communication, Https communication consumes more CPU and memory resources due to encryption and reduction processing;
Cost: Https communication requires a certificate;

The difference between get and post request

Get requests can be cached, but Post cannot.
Post is a little safer than Get, because Get requests are included in the URL, and
get will be saved by the browser in history. Post does not, but it is the same in the case of packet capture.
Post can transmit more data than Get through the request body.
Get does not have this technical URL length limit, which will affect the Get request, but this length limit is specified by the browser, not the RFC. Post supports more encoding types and No restrictions on data types

Guess you like

Origin blog.csdn.net/weixin_54163765/article/details/114803733