目录 搜索
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
文字

在HTML5中,一些 HTML 元素提供了对 CORS 的支持, 例如<img>和 <video>均有一个跨域属性 (crossOriginproperty),它允许你配置元素获取数据的 CORS 请求。 这些属性是枚举的,并具有以下可能的值:

关键词

描述

匿名

此元素的CORS请求将不会设置凭证标志。

使用的凭据

此元素的CORS请求将设置凭证标志; 这意味着请求将提供凭据。

默认情况下 (即未指定crossOrigin属性时), CORS 根本不会使用。如Terminology section of the CORS specification 中的描述, “anonymous" 关键字说明不会通过 cookies,客户端 SSL 证书或 HTTP 认证交换用户凭据。

即使是无效的关键字和空字符串也会被当作 anonymous关键字使用。

示例: 使用 crossorigin 的 script 元素

你可以使用下面的<script>元素告诉一个浏览器执行来自 https://example.com/example-framework.js 的脚本而不发送用户凭据。

<script src="https://example.com/example-framework.js"
        crossorigin="anonymous"></script>

规范

规范

状态

评论

HTML Living Standard该规范中'CORS设置属性'的定义。

生活水平


HTML生活标准该规范中'跨部门'的定义。

生活水平


浏览器兼容性

Feature

Chrome

Firefox (Gecko)

Internet Explorer

Opera

Safari (WebKit)

Basic support

13

8.0 (8.0)

11

No support

(Yes)

<video>

?

12.0 (12.0)

?

?

?

Feature

Android

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

?

8.0 (8.0)

?

?

(Yes)

<video>

?

12.0 (12.0)

?

?

?

上一篇: 下一篇: