{"id":7724,"date":"2019-06-15T10:30:22","date_gmt":"2019-06-15T14:30:22","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=7724"},"modified":"2021-12-08T11:01:13","modified_gmt":"2021-12-08T16:01:13","slug":"integrity-crossorigin-script","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/integrity-crossorigin-script\/","title":{"rendered":"What do Integrity and Crossorigin in HTML Script Tags Mean?"},"content":{"rendered":"\n
So what are all those Integrity and Crossorigin attributes you commonly find with script link tags? Well, these are used as an added layer of security over how to load scripts that can be controlled explicitly by the web developer<\/a>.<\/p>\n\n\n\n Here is the breakdown of what these attributes do.<\/p>\n\n\n\n SRI is a new W3C specification that allows web developers to ensure that resources hosted on third-party servers have not been tampered with. It is highly recommended that one uses SRI as a best practice, whenever libraries<\/a> are loaded from third-party sources.<\/p>\n\n\n\n The Integrity attribute defines the hash value of a resource loaded from a third-party source that has to match in order for the browser to execute it.<\/p>\n\n\n\n This is an important attribute because there is always the risk of attackers modifying resources on the server which can get loaded and executed on the end -users’ browser.<\/p>\n\n\n\n This is a feature that uses additional HTTP headers to tell a web browser<\/a> to let a web application running at one origin (usually a domain) have permission to access selected resources from a server at a different origin (domain).<\/p>\n\n\n\n The possible values are You can find out more about Subresource Integrity from here<\/a> and details about Cross-Origin Resource Sharing can be found here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" So what are all those Integrity and Crossorigin attributes you commonly find with script link tags? Well, these are used as an added layer of security over how to load…<\/p>\n","protected":false},"author":1,"featured_media":7725,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,27,16,17],"tags":[106,313,328,424,433,523,526,543,544,635,636,638],"yoast_head":"\n<script src="https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/twitter-bootstrap\/4.3.1\/js\/bootstrap.min.js" integrity="sha256-CjSoeELFOcH0\/uxWu6mC\/Vlrc1AARqbm\/jiiImDGV3s=" crossorigin="anonymous"><\/script><\/code><\/pre>\n\n\n\n
Subresource Integrity (SRI)<\/h2>\n\n\n\n
Cross-Origin Resource Sharing (CORS)<\/h2>\n\n\n\n
use-credentials<\/code> and
anonymous<\/code>.<\/p>\n\n\n\n