什么是完整性和crossorigin属性? [英] What are the integrity and crossorigin attributes?

查看:331
本文介绍了什么是完整性和crossorigin属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bootstrapcdn最近改变了他们的链接。它现在看起来像这样:

 < link href =https://maxcdn.bootstrapcdn.com/bootstrap/3.3。 5 / CSS / bootstrap.min.css 
的rel = 样式表
完整性= SHA256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc = SHA512-dTfge / zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz / ixG7ArTxmDjLXDmezHubeNikyKGVyQ ==
crossorigin = 匿名 > ;

完整性 crossorigin 属性是什么意思?它们如何影响样式表的加载?

解决方案

这两个属性都已添加到Bootstrap CDN中以实现子资源完整性



子资源完整性定义了一种机制用户代理可能会验证提取的资源是否已交付,而不会出现意外操作参考 a>

完整性属性允许浏览器检查文件源,以确保源代码已被操作时永不加载代码。



Crossorigin属性在使用'CORS'加载请求时存在,现在需要SRI检查,同源。
有关crossorigin的更多信息



有关Bootstrap CDN实施的更多详细信息


Bootstrapcdn recently changed their links. It now looks like this:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" 
rel="stylesheet" 
integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" 
crossorigin="anonymous">

What do the integrity and crossorigin attributes mean? How do they affect the loading of the stylesheet?

解决方案

Both attributes have been added to Bootstrap CDN to implement Subresource Integrity.

Subresource Integrity defines a mechanism by which user agents may verify that a fetched resource has been delivered without unexpected manipulation Reference

Integrity attribute is to allow the browser to check the file source to ensure that the code is never loaded if the source has been manipulated.

Crossorigin attribute is present when a request is loaded using 'CORS' which is now a requirement of SRI checking when not loaded from the 'same-origin'. More info on crossorigin

More detail on Bootstrap CDNs implementation

这篇关于什么是完整性和crossorigin属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆