牛仔裙配什么上衣好看| 如来佛祖和释迦牟尼是什么关系| 孕妇感冒可以吃什么感冒药| 又什么又什么的花| 1975年属什么生肖| 大姨妈发黑是什么原因| 灵芝与什么相克| 丑未戌三刑 会发生什么| 胃痛呕吐什么原因| 脚出汗多是什么原因怎么办| 中国的特工组织叫什么| 右侧肋骨下面是什么器官| 梦见买东西是什么意思| 佳字属于五行属什么| 憋屈是什么意思| 赖是什么意思| 什么是性质| 胃大肚子大是什么原因| 离子水是什么水| 腹部b超能检查什么| 什么叫肛裂| 什么时间英文| 君子兰用什么土最好| 布病是什么症状| 聚乙二醇400是什么| 花生和什么不能一起吃| 破日是什么意思| idh是什么意思| cln是什么意思| 经期适合吃什么食物| 头头是道什么意思| 痛风忌口不能吃什么东西| 心如刀割是什么意思| 为什么蚊子要吸血| 苍蝇馆子什么意思| 林冲是什么生肖| 土豆什么时候种植| 1955年属羊的是什么命| 小布丁是什么意思| 单亲家庭是指什么| 旧人是什么意思| 根是什么意思| 历经是什么意思| 什么的草帽| 炎症吃什么药| 1979属什么| 舌头凉凉的是什么原因| josiny是什么牌子| 钟点房是什么意思| 九月三号是什么日子| 扬州有什么好玩的| 不一样的烟火什么意思| 误会是什么意思| 眩晕去医院挂什么科室| 笑靥如花什么意思| 什么察秋毫| 蛞蝓是什么| 什么好像什么造句| 阴茎破皮擦什么药| 月经一直不停有什么办法止血| 糠是什么| 很轴是什么意思| 世界上最小的花是什么花| MECT是什么| 18岁是什么年华| 原则上是什么意思| 00年属什么的| 双生什么意思| 炸毛是什么意思| 昆虫记是什么类型的书| 耳石症挂什么科| 蛇吐信子是什么意思| o型血可以接受什么血型| 梦见头发白了是什么意思| 男人吃什么可以增强性功能| below是什么意思| 感冒发烧挂什么科室| mini是什么车| 梦到生孩子是什么意思| 叶酸是什么维生素| 十一月四日是什么星座| rm是什么币| 脸上皮肤痒是什么原因| diy什么意思| 2点是什么时辰| 髋关节积液是什么原因造成的| 梦见老公出轨预示什么| 包皮痒用什么药| 腌羊肉串放什么调料| 两岁宝宝不会说话但什么都知道| 为什么一直打喷嚏| 蝙蝠是什么动物| 梦到装修房子是什么征兆| 活力是什么意思| 一朵什么| 脚上长水泡是什么原因| v是什么化学元素| 36 80是什么罩杯| 何其是什么意思| 什么药治牙疼最快| 酸萝卜别吃什么意思| 大祭司是什么意思| 人均gdp是什么意思| 老鼠的克星是什么| 男科什么医院好| 防晒霜什么牌子好| 小叶紫檀五行属什么| 五月十三是什么星座| 舌头上有齿痕是什么原因| 课代表是什么意思| 重字五行属什么| 天上的星星像什么| 小老头是什么意思| hp感染是什么意思| 芙蓉是什么花| 1004是什么星座| 什么是脱脂牛奶| 孩子爱流鼻血是什么原因| 心烦意乱吃什么药| 呼吸内科主要看什么病| 抱持是什么意思| 右边偏头痛是什么原因| 血压高降不下来是什么原因| 人工周期是什么意思| 蒙脱石散不能和什么药一起吃| 尿道口感染吃什么药| 吃什么对眼睛近视好| 女人梦见猫是什么预兆| 牙虫长什么样子| 梦见自己在飞是什么征兆| 什么是淋病| 蒲公英和玫瑰花一起泡有什么功效| 火代表什么数字| 痛风病人不能吃什么| 牙齿突然出血是什么原因| 锁骨属于什么骨| 做梦梦到捡钱是什么征兆| 办理公证需要什么材料| 丛林之王是什么动物| 寒凝血瘀吃什么中成药| 羊鞭是什么| 掰手指头响有什么危害| yk是什么意思| 喝什么最容易减肥| 大蒜泡酒有什么功效| 11月13日什么星座| 健身hit什么意思| 一个大一个小念什么| 芙蕖是什么花| 抗战纪念日为什么是9月3日| 擦伤涂什么药膏| 睡觉打呼噜什么原因| 牙龈肿痛用什么药| 膝盖酸是什么原因| 大生化挂什么科| 国五行属什么| 蛋白石是什么| 念珠菌性阴道炎用什么药| 百合是什么植物| 一什么春笋| 喜欢白色的女人是什么性格| 肾结石要注意什么| 00后是什么意思| 左下眼皮跳是什么预兆| 心脏看什么科| 心境什么意思| 桥本氏病是什么病| 姨妈老是推迟是为什么| 上火喝什么茶| 绿色的大便是什么原因| 人鱼小姐大结局是什么| 什么样的人不适合吃人参| 属狗的幸运色是什么颜色| 荔枝与什么不能同吃| 经常嗓子疼是什么原因| 香奈儿是什么品牌| 乳腺结节钙化是什么意思| 蚕蛹过敏什么办法最快| 血肿是什么意思| 小知了叫什么| 顾里为什么和席城睡了| 手背出汗是什么原因| 天铁是什么| 处女座与什么星座最配| 梦见白菜是什么预兆| 斗战胜佛是什么意思| 眉头下方有痣代表什么| 拉屎臭是什么原因| 发烧喉咙痛吃什么药好| 石墨灰是什么颜色| 堃是什么意思| 什么是离子| 枸杞有什么用| 钙片什么时候吃最好| 石字旁有什么字| 化作风化作雨是什么歌| 室性早搏是什么意思| 弱智是什么意思| 脑洞是什么意思| 海胆是什么| wl是什么意思| 熊吃什么食物| 广州立冬吃什么| 饭后胃胀是什么原因导致的| 补锌吃什么| 小腿麻木是什么原因| 十指不沾阳春水是什么意思| 膝跳反射属于什么反射| dn是什么| 中暑发烧吃什么药| 照护保险是什么| dn是什么意思| 麦芽糊精是什么| 什么算熬夜| 南京为什么叫金陵| mdzz是什么意思| 垂体瘤挂什么科| 蛋白尿是什么| 月子餐第一周吃什么| 半夜是什么时辰| 多囊性改变是什么意思| 高考明天考什么| 宫颈糜烂用什么药比较好| 十年大运是什么意思| 脚底干裂起硬皮是什么原因怎么治| 左后背发麻是什么原因| 定位是什么意思| cdfi可见血流信号是什么意思| 保拉纳啤酒什么档次| 与众不同是什么意思| 榴莲有什么作用| 痛风吃什么药好| 为什么喝中药会拉肚子| 复方乙酰水杨酸片是什么药| 爿是什么意思| 老是嗝气是什么原因| 什么叫欲擒故纵| 发蜡是什么| 感冒有什么症状| 一个山一个见读什么| 后会无期什么意思| 蕞是什么意思| 喉咙细菌感染吃什么药| 石榴花是什么季节开的| 一个均一个金念什么| 银环蛇咬伤后什么症状| 大力是什么药| 物极必反什么意思| 心肌供血不足是什么原因造成的| 胸闷气短吃什么中成药| 方脸适合什么刘海| 吃什么利尿最快去腹水的| 什么品种的榴莲最好吃| 空调输入功率是什么意思| 嗓子痒痒是什么原因| 下巴长痘什么原因| 梦见拔花生是什么预兆| 起床气是什么意思| 1981年是什么年| 吃什么才能提高免疫力| 赤诚相见是什么意思| 珍馐是什么意思| 勃起是什么意思| 三七粉什么人不适合吃| 百度
    1. 2.4 URLs
      1. 2.4.1 Terminology
      2. 2.4.2 Parsing URLs
      3. 2.4.3 Document base URLs
    2. 2.5 Fetching resources
      1. 2.5.1 Terminology
      2. 2.5.2 Determining the type of a resource
      3. 2.5.3 Extracting character encodings from meta elements
      4. 2.5.4 CORS settings attributes
      5. 2.5.5 Referrer policy attributes
      6. 2.5.6 Nonce attributes
      7. 2.5.7 Lazy loading attributes
      8. 2.5.8 Blocking attributes
      9. 2.5.9 Fetch priority attributes

2.4 URLs

2.4.1 Terminology

A string is a valid non-empty URL if it is a valid URL string but it is not the empty string.

A string is a valid URL potentially surrounded by spaces if, after stripping leading and trailing ASCII whitespace from it, it is a valid URL string.

A string is a valid non-empty URL potentially surrounded by spaces if, after stripping leading and trailing ASCII whitespace from it, it is a valid non-empty URL.


This specification defines the URL about:legacy-compat as a reserved, though unresolvable, about: URL, for use in DOCTYPEs in HTML documents when needed for compatibility with XML tools. [ABOUT]

This specification defines the URL about:html-kind as a reserved, though unresolvable, about: URL, that is used as an identifier for kinds of media tracks. [ABOUT]

This specification defines the URL about:srcdoc as a reserved, though unresolvable, about: URL, that is used as the URL of iframe srcdoc documents. [ABOUT]


A URL matches about:blank if its scheme is "about", its path contains a single string "blank", its username and password are the empty string, and its host is null.

Such a URL's query and fragment can be non-null. For example, the URL record created by parsing "about:blank?foo#bar" matches about:blank.

A URL matches about:srcdoc if its scheme is "about", its path contains a single string "srcdoc", its query is null, its username and password are the empty string, and its host is null.

The reason that matches about:srcdoc ensures that the URL's query is null is because it is not possible to create an iframe srcdoc document whose URL has a non-null query, unlike Documents whose URL matches about:blank. In other words, the set of all URLs that match about:srcdoc only vary in their fragment.

2.4.2 Parsing URLs

Parsing a URL is the process of taking a string and obtaining the URL record that it represents. While this process is defined in URL, the HTML standard defines several wrappers to abstract base URLs and encodings. [URL]

Most new APIs are to use parse a URL. Older APIs and HTML elements might have reason to use encoding-parse a URL. When a custom base URL is needed or no base URL is desired, the URL parser can of course be used directly as well.

To parse a URL, given a string url, relative to a Document object or environment settings object environment, run these steps. They return failure or a URL.

  1. Let baseURL be environment's base URL, if environment is a Document object; otherwise environment's API base URL.

  2. Return the result of applying the URL parser to url, with baseURL.

To encoding-parse a URL, given a string url, relative to a Document object or environment settings object environment, run these steps. They return failure or a URL.

  1. Let encoding be UTF-8.

  2. If environment is a Document object, then set encoding to environment's character encoding.

  3. Otherwise, if environment's relevant global object is a Window object, set encoding to environment's relevant global object's associated Document's character encoding.

  4. Let baseURL be environment's base URL, if environment is a Document object; otherwise environment's API base URL.

  5. Return the result of applying the URL parser to url, with baseURL and encoding.

To encoding-parse-and-serialize a URL, given a string url, relative to a Document object or environment settings object environment, run these steps. They return failure or a string.

  1. Let url be the result of encoding-parsing a URL given url, relative to environment.

  2. If url is failure, then return failure.

  3. Return the result of applying the URL serializer to url.

2.4.3 Document base URLs

The document base URL of a Document document is the URL record obtained by running these steps:

  1. If document has no descendant base element that has an href attribute, then return document's fallback base URL.

  2. Otherwise, return the frozen base URL of the first base element in document that has an href attribute, in tree order.

The fallback base URL of a Document object document is the URL record obtained by running these steps:

  1. If document is an iframe srcdoc document:

    1. Assert: document's about base URL is non-null.

    2. Return document's about base URL.

  2. If document's URL matches about:blank and document's about base URL is non-null, then return document's about base URL.

  3. Return document's URL.


To set the URL for a Document document to a URL record url:

  1. Set document's URL to url.

  2. Respond to base URL changes given document.

To respond to base URL changes for a Document document:

  1. The user agent should update any user interface elements which are displaying affected URLs, or data derived from such URLs, to the user. Examples of such user interface elements would be a status bar that displays a hyperlink's url, or some user interface which displays the URL specified by a q, blockquote, ins, or del element's cite attribute.

  2. Ensure that the CSS :link/:visited/etc. pseudo-classes are updated appropriately.

This means that changing the base URL doesn't affect, for example, the image displayed by img elements. Thus, subsequent accesses of the src IDL attribute from script will return a new absolute URL that might no longer correspond to the image being shown.

2.5 Fetching resources

2.5.1 Terminology

A response whose type is "basic", "cors", or "default" is CORS-same-origin. [FETCH]

A response whose type is "opaque" or "opaqueredirect" is CORS-cross-origin.

A response's unsafe response is its internal response if it has one, and the response itself otherwise.

To create a potential-CORS request, given a url, destination, corsAttributeState, and an optional same-origin fallback flag, run these steps:

  1. Let mode be "no-cors" if corsAttributeState is No CORS, and "cors" otherwise.

  2. If same-origin fallback flag is set and mode is "no-cors", set mode to "same-origin".

  3. Let credentialsMode be "include".

  4. If corsAttributeState is Anonymous, set credentialsMode to "same-origin".

  5. Return a new request whose URL is url, destination is destination, mode is mode, credentials mode is credentialsMode, and whose use-URL-credentials flag is set.

2.5.2 Determining the type of a resource

The Content-Type metadata of a resource must be obtained and interpreted in a manner consistent with the requirements of MIME Sniffing. [MIMESNIFF]

The computed MIME type of a resource must be found in a manner consistent with the requirements given in MIME Sniffing. [MIMESNIFF]

The rules for sniffing images specifically, the rules for distinguishing if a resource is text or binary, and the rules for sniffing audio and video specifically are also defined in MIME Sniffing. These rules return a MIME type as their result. [MIMESNIFF]

It is imperative that the rules in MIME Sniffing be followed exactly. When a user agent uses different heuristics for content type detection than the server expects, security problems can occur. For more details, see MIME Sniffing. [MIMESNIFF]

2.5.3 Extracting character encodings from meta elements

The algorithm for extracting a character encoding from a meta element, given a string s, is as follows. It returns either a character encoding or nothing.

  1. Let position be a pointer into s, initially pointing at the start of the string.

  2. Loop: Find the first seven characters in s after position that are an ASCII case-insensitive match for the word "charset". If no such match is found, return nothing.

  3. Skip any ASCII whitespace that immediately follow the word "charset" (there might not be any).

  4. If the next character is not a U+003D EQUALS SIGN (=), then move position to point just before that next character, and jump back to the step labeled loop.

  5. Skip any ASCII whitespace that immediately follow the equals sign (there might not be any).

  6. Process the next character as follows:

    If it is a U+0022 QUOTATION MARK character (") and there is a later U+0022 QUOTATION MARK character (") in s
    If it is a U+0027 APOSTROPHE character (') and there is a later U+0027 APOSTROPHE character (') in s
    Return the result of getting an encoding from the substring that is between this character and the next earliest occurrence of this character.
    If it is an unmatched U+0022 QUOTATION MARK character (")
    If it is an unmatched U+0027 APOSTROPHE character (')
    If there is no next character
    Return nothing.
    Otherwise
    Return the result of getting an encoding from the substring that consists of this character up to but not including the first ASCII whitespace or U+003B SEMICOLON character (;), or the end of s, whichever comes first.

This algorithm is distinct from those in the HTTP specifications (for example, HTTP doesn't allow the use of single quotes and requires supporting a backslash-escape mechanism that is not supported by this algorithm). While the algorithm is used in contexts that, historically, were related to HTTP, the syntax as supported by implementations diverged some time ago. [HTTP]

2.5.4 CORS settings attributes

Attributes/crossorigin

Support in all current engines.

Firefox8+Safari6+Chrome13+
Opera?Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

A CORS settings attribute is an enumerated attribute with the following keywords and states:

Keyword State Brief description
anonymous Anonymous Requests for the element will have their mode set to "cors" and their credentials mode set to "same-origin".
(the empty string)
use-credentials Use Credentials Requests for the element will have their mode set to "cors" and their credentials mode set to "include".

The attribute's missing value default is the No CORS state, and its invalid value default is the Anonymous state.

The majority of fetches governed by CORS settings attributes will be done via the create a potential-CORS request algorithm.

For more modern features, where the request's mode is always "cors", certain CORS settings attributes have been repurposed to have a slightly different meaning, wherein they only impact the request's credentials mode. To perform this translation, we define the CORS settings attribute credentials mode for a given CORS settings attribute to be determined by switching on the attribute's state:

No CORS
Anonymous
"same-origin"
Use Credentials
"include"

2.5.5 Referrer policy attributes

A referrer policy attribute is an enumerated attribute. Each referrer policy, including the empty string, is a keyword for this attribute, mapping to a state of the same name.

The attribute's missing value default and invalid value default are both the empty string state.

The impact of these states on the processing model of various fetches is defined in more detail throughout this specification, in Fetch, and in Referrer Policy. [FETCH] [REFERRERPOLICY]

Several signals can contribute to which processing model is used for a given fetch; a referrer policy attribute is only one of them. In general, the order in which these signals are processed are:

  1. First, the presence of a noreferrer link type;

  2. Then, the value of a referrer policy attribute;

  3. Then, the presence of any meta element with name attribute set to referrer.

  4. Finally, the `Referrer-Policy` HTTP header.

2.5.6 Nonce attributes

Global_attributes/nonce

Support in all current engines.

Firefox31+SafariYesChromeYes
Opera?EdgeYes
Edge (Legacy)?Internet ExplorerNo
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

A nonce content attribute represents a cryptographic nonce ("number used once") which can be used by Content Security Policy to determine whether or not a given fetch will be allowed to proceed. The value is text. [CSP]

Elements that have a nonce content attribute ensure that the cryptographic nonce is only exposed to script (and not to side-channels like CSS attribute selectors) by taking the value from the content attribute, moving it into an internal slot named [[CryptographicNonce]], exposing it to script via the HTMLOrSVGElement interface mixin, and setting the content attribute to the empty string. Unless otherwise specified, the slot's value is the empty string.

element.nonce

Returns the value set for element's cryptographic nonce. If the setter was not used, this will be the value originally found in the nonce content attribute.

element.nonce = value

Updates element's cryptographic nonce value.

HTMLElement/nonce

Firefox75+Safari?? 10+Chrome61+
Opera?Edge79+
Edge (Legacy)?Internet ExplorerNo
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

The nonce IDL attribute must, on getting, return the value of this element's [[CryptographicNonce]]; and on setting, set this element's [[CryptographicNonce]] to the given value.

Note how the setter for the nonce IDL attribute does not update the corresponding content attribute. This, as well as the below setting of the nonce content attribute to the empty string when an element becomes browsing-context connected, is meant to prevent exfiltration of the nonce value through mechanisms that can easily read content attributes, such as selectors. Learn more in issue #2369, where this behavior was introduced.

The following attribute change steps are used for the nonce content attribute:

  1. If element does not include HTMLOrSVGElement, then return.

  2. If localName is not nonce or namespace is not null, then return.

  3. If value is null, then set element's [[CryptographicNonce]] to the empty string.

  4. Otherwise, set element's [[CryptographicNonce]] to value.

Whenever an element including HTMLOrSVGElement becomes browsing-context connected, the user agent must execute the following steps on the element:

  1. Let CSP list be element's shadow-including root's policy container's CSP list.

  2. If CSP list contains a header-delivered Content Security Policy, and element has a nonce content attribute whose value is not the empty string, then:

    1. Let nonce be element's [[CryptographicNonce]].

    2. Set an attribute value for element using "nonce" and the empty string.

    3. Set element's [[CryptographicNonce]] to nonce.

    If element's [[CryptographicNonce]] were not restored it would be the empty string at this point.

The cloning steps for elements that include HTMLOrSVGElement given node, copy, and subtree are to set copy's [[CryptographicNonce]] to node's [[CryptographicNonce]].

2.5.7 Lazy loading attributes

Lazy_loading

Support in all current engines.

Firefox75+Safari15.4+Chrome77+
Opera?Edge79+
Edge (Legacy)?Internet ExplorerNo
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

A lazy loading attribute is an enumerated attribute with the following keywords and states:

Keyword State Brief description
lazy Lazy Used to defer fetching a resource until some conditions are met.
eager Eager Used to fetch a resource immediately; the default state.

The attribute directs the user agent to fetch a resource immediately or to defer fetching until some conditions associated with the element are met, according to the attribute's current state.

The attribute's missing value default and invalid value default are both the Eager state.


The will lazy load element steps, given an element element, are as follows:

  1. If scripting is disabled for element, then return false.

    This is an anti-tracking measure, because if a user agent supported lazy loading when scripting is disabled, it would still be possible for a site to track a user's approximate scroll position throughout a session, by strategically placing images in a page's markup such that a server can track how many images are requested and when.

  2. If element's lazy loading attribute is in the Lazy state, then return true.

  3. Return false.

Each img and iframe element has associated lazy load resumption steps, initially null.

For img and iframe elements that will lazy load, these steps are run from the lazy load intersection observer's callback or when their lazy loading attribute is set to the Eager state. This causes the element to continue loading.

Each Document has a lazy load intersection observer, initially set to null but can be set to an IntersectionObserver instance.

To start intersection-observing a lazy loading element element, run these steps:

  1. Let doc be element's node document.

  2. If doc's lazy load intersection observer is null, set it to a new IntersectionObserver instance, initialized as follows:

    The intention is to use the original value of the IntersectionObserver constructor. However, we're forced to use the JavaScript-exposed constructor in this specification, until Intersection Observer exposes low-level hooks for use in specifications. See bug w3c/IntersectionObserver#464 which tracks this. [INTERSECTIONOBSERVER]

  3. Call doc's lazy load intersection observer's observe method with element as the argument.

    The intention is to use the original value of the observe method. See w3c/IntersectionObserver#464. [INTERSECTIONOBSERVER]

To stop intersection-observing a lazy loading element element, run these steps:

  1. Let doc be element's node document.

  2. Assert: doc's lazy load intersection observer is not null.

  3. Call doc's lazy load intersection observer's unobserve method with element as the argument.

    The intention is to use the original value of the unobserve method. See w3c/IntersectionObserver#464. [INTERSECTIONOBSERVER]

(This is a tracking vector.) The lazy load scroll margin is an implementation-defined value, but with the following suggestions to consider:

It is important for privacy that the lazy load scroll margin not leak additional information. For example, the typical scrolling speed on the current device could be imprecise so as to not introduce a new fingerprinting vector.

2.5.8 Blocking attributes

A blocking attribute explicitly indicates that certain operations should be blocked on the fetching of an external resource. The operations that can be blocked are represented by possible blocking tokens, which are strings listed by the following table:

Possible blocking token Description
"render" The element is potentially render-blocking.

In the future, there might be more possible blocking tokens.

A blocking attribute must have a value that is an unordered set of unique space-separated tokens, each of which are possible blocking tokens. The supported tokens of a blocking attribute are the possible blocking tokens. Any element can have at most one blocking attribute.

The blocking tokens set for an element el are the result of the following steps:

  1. Let value be the value of el's blocking attribute, or the empty string if no such attribute exists.

  2. Set value to value, converted to ASCII lowercase.

  3. Let rawTokens be the result of splitting value on ASCII whitespace.

  4. Return a set containing the elements of rawTokens that are possible blocking tokens.

An element is potentially render-blocking if its blocking tokens set contains "render", or if it is implicitly potentially render-blocking, which will be defined at the individual elements. By default, an element is not implicitly potentially render-blocking.

2.5.9 Fetch priority attributes

A fetch priority attribute is an enumerated attribute with the following keywords and states:

Keyword State Brief description
high High Signals a high-priority fetch relative to other resources with the same destination.
low Low Signals a low-priority fetch relative to other resources with the same destination.
auto Auto Signals automatic determination of fetch priority relative to other resources with the same destination.

The attribute's missing value default and invalid value default are both the Auto state.

百度