crossorigin

crossorigin属性

在HTML5中, <img>, <video> or <script>可以跨域, 并且有crossorigin属性,可以配置CORS(Cross-Origin Resource Sharing )请求,属性是可枚举值:

  • anonymous

Requests for the element will have their mode set to "cors" and their credentials mode set to "same-origin".

  • use-credentials

Requests for the element will have their mode set to "cors" and their credentials mode set to "include".

By default (that is, when the attribute is not specified), CORS is not used at all. The "anonymous" keyword means that there will be no exchange of user credentials via cookies, client-side SSL certificates or HTTP authentication as described in the Terminology section of the CORS specification, unless it is in the same origin.

如果不设置该属性,CORS 不起作用。

An invalid keyword and an empty string will be handled as the anonymous keyword.

非法字符或者为空视作anonymous

credentials mode

  • "omit"

Excludes credentials from this request.

  • "same-origin"

Include credentials with requests made to same-origin URLs.

  • Include

Always includes credentials with this request.

Request’s credentials mode controls the flow of credentials during a fetch. When request’s mode is "navigate", its credentials mode is assumed to be "include" and fetch does not currently account for other values. If HTML changes here, this standard will need corresponding changes.

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值