Tag Archives: Web front-end development

What are the web front end technologies? What are the differences between cookie and session

What are the Web front-end technologies?What’s the difference between a Cookie and a Session?Cookies and Sessions are common techniques in Web applications that can be used to track a user’s entire Session. But what’s the difference between them?Next thousand front Xiaobian will give you a brief introduction.
 

 
The main purpose
Cookie is born to solve the problem that HTTP stateless characteristics can not meet the interactive Web, mainly used for session state management (such as user login status, shopping cart, game scores or other information to record); Personalization Settings (such as user-defined Settings, themes, etc.); Browser behavior tracking (e.g., tracking and analyzing user behavior).
Session is a mechanism used by the server to record the state of the client. It is simpler to use than Cookie, and it also increases the storage pressure of the server accordingly.
If the Cookie mechanism confirms the identity of the customer by checking the “pass” on the customer, then the Session mechanism confirms the identity of the customer by checking the “customer list” on the server. Session is equivalent to a client profile created by the program on the server. When the client visits, it only needs to query the client profile table.
Usage scenarios
Cookie technology can store information in different browsers, and can achieve multiple requests for data sharing, divided into temporary cookies and long-term cookies. If a Cookie has no expiry date set, the browser will delete the Cookie when it is closed. This Cookie is called a temporary Cookie. If a Cookie has an expiration date, then the browser will keep the Cookie until the expiration date. This Cookie is called a persistent Cookie.
Session is a communication state retention mechanism based on Cookie, which can store some information of a user on the server side. After creating a Session, the server returns the Session ID to the browser in the form of Cookie. If the browser is closed, it will carry the Session ID when visiting the server again. When the server finds that the browser brings the Session ID, it will use the corresponding Session in memory to serve it.
What is the relationship between a Cookie and a Session
If a Web front-end programmer is asked “What is the relationship between Cookie and Session?” during an interview, the answer is that both are produced for client-server interaction. Cookie writes the user’s data to the user’s browser, while Session technology writes the user’s data to the user’s own Session. A Session is an object, and its properties can be of any type (cookies can only be set as strings). Cookie is stored in the client side, the disadvantage is easy to forge, not secure, Session is stored in the server side, will consume server resources, Session implementation has two ways: Cookie and URL rewriting.
If you want to know more about cookies and sessions, or want to quickly advance to the front end of the Web, you can choose a major to learn, so that you can learn efficiently and quickly get employed.
 

How to solve the cross domain problem of Axios in Vue project

first step, configure BaseUrl:
. In main.js, configure the Url we visit with the prefix: axios.defaults. BaseUrl = ‘/ API’ // develop the local agent;
second step, configure the agent:
modify the index.js file under config folder, add relevant code in proxyTable:
third step, modify the request URL:
this.$axios.get(“/test/test123”). { console.log(res) }) .catch(err=> { console.log(err) })