KinoOfficial / front-end_Interview

0 stars 0 forks source link

例题 #4

Open KinoOfficial opened 6 days ago

KinoOfficial commented 6 days ago

问题 1:HTML5 新特性有哪些 What are the new features of HTML5?

语义化标签 Semantic tags

音视频处理API(audio,video)

canvas / webGL

拖拽释放(Drag and drop) API

history API

requestAnimationFrame

地理位置(Geolocation)API

webSocket

web存储 localStorage、SessionStorage

表单控件,calendar、date、time、email、url、search

KinoOfficial commented 6 days ago

HTTP 状态码 HTTP Status Codes

1xx:指示信息类,表示请求已接受,继续处理(临时响应)

2xx:指示成功类,表示请求已成功接受

3xx:指示重定向,表示要完成请求必须进行更进一步的操作

4xx:指示客户端错误,请求有语法错误或请求无法实现

5xx:指示服务器错误,服务器未能实现合法的请求

常见状态码

【403】表示【服务器拒绝执行客户端的请求】

【404】表示【服务器找不到客户端所请求的资源(网页)】

【304】表示【所请求的资源并未修改(命中协商缓存)

1xx: indicates information class, indicating that the request has been accepted and continues to be processed (temporary response)

2xx: indicates success class, indicating that the request has been successfully accepted

3xx: indicates redirection, indicating that further operations must be performed to complete the request

4xx: indicates client error, the request has a syntax error or the request cannot be implemented

5xx: indicates server error, the server fails to implement a legal request

Common status codes

[403] means [the server refuses to execute the client's request]

[404] means [the server cannot find the resource (web page) requested by the client]

[304] means [the requested resource has not been modified (hit the negotiation cache)

KinoOfficial commented 6 days ago

HTML5 语义化的优点 Advantages of HTML5 semantics

在没CSS样式的情况下,页面整体也会呈现很好的结构效果

代码结构清晰,易于阅读,

利于开发和维护 方便其他设备解析(如屏幕阅读器)根据语义渲染网页。

有利于搜索引擎优化(SEO),搜索引擎爬虫会根据不同的标签来赋予不同的权重

Without CSS styles, the overall page will also present a good structural effect

The code structure is clear and easy to read,

It is conducive to development and maintenance. It is convenient for other devices to parse (such as screen readers) and render web pages according to semantics.

It is conducive to search engine optimization (SEO). Search engine crawlers will assign different weights according to different tags

KinoOfficial commented 6 days ago

介绍下 304 过程 Introducing the 304 process

缓存过期后向服务器发起请求验证缓存是否有效,有效的话则返回304。304多出现在对于静态资源的请求上面。对于静态资源来说:

当浏览器第一次发起请求时(请求头中没有If-Modified-Since),server会在响应中告诉浏览器这个资源最后修改的时间(响应头中的Last-Modified)。当你再次请求这个资源时,浏览器会询问server这个资源有没有被修改(请求头中If-Modified-Since)。

如果资源没有被修改,server返回304状态码,浏览器使用本地的缓存文件。

After the cache expires, a request is made to the server to verify whether the cache is valid. If it is valid, a 304 status code is returned. 304 often appears in requests for static resources. For static resources:

When the browser makes the first request (there is no If-Modified-Since in the request header), the server will tell the browser in the response when the resource was last modified (Last-Modified in the response header). When you request this resource again, the browser will ask the server whether the resource has been modified (If-Modified-Since in the request header).

If the resource has not been modified, the server returns a 304 status code, and the browser uses the local cache file.

KinoOfficial commented 5 days ago

.Doctype 作用? DOCTYPE 是用来声明文档类型和 DTD 规范的。 <!DOCTYPE html>声明位于 HTML 文档中的第一行,不是一个 HTML 标签,处于 html 标签之前。告知浏览器的解析器用什么文档标准解析这个文档。DOCTYPE 不存在或格式不正确会导致文档以兼容模式呈现。

作者:LeetCode 链接:https://leetcode.cn/leetbook/read/da-han-qian-duan-gang-ti-mu-he-ji/nlqmue/ 来源:力扣(LeetCode) 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。