HomeRelated InformationThe integrity and crossorigin fields in the link tag
The integrity and crossorigin fields in the link tag
Table of Contents

crossorigin:

This enumeration property specifies whether CORS must be used when loading related images. Possible values ​​include the following two:

  • anonymous: This will initiate a cross-origin request (i.e., include the Origin: HTTP header). However, it will not send any authentication information (i.e., no cookies, X.509 certificates, or HTTP basic authentication information). If the server does not provide origin server credentials (and does not set the Access-Control-Allow-Origin: HTTP header), the image will be poisoned and its use will be restricted.

  • `use-credentials`: This will initiate a cross-origin request (i.e., include the `Origin:` HTTP header) with authentication information (sending cookies, X.509 certificates, and HTTP basic authentication information). If the server does not provide origin server credentials (does not set the `Access-Control-Allow-Origin:` HTTP header), the image will be corrupted and its use will be restricted.

  • When this attribute is not set, the resource will not be loaded using CORS (i.e., the Origin: HTTP header will not be sent), which will prevent its use in the element. If an invalid value is set, it will be treated as anonymous.

integrity

Subresource Integrity (SRI) is a security feature that enables browsers to verify that files they fetch (for example, from a CDN) are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that a fetched file must match.

Translation:

Sub-Resource Integrity (SRI) is a security feature that allows browsers to verify that files they fetch (e.g., from a CDN) have been delivered without any unintended actions. It works by allowing you to provide a cryptographic hash/hash that the fetched file must match.

Example:

<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">  
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
Software Applications: Front-end template download; development and design; SEO optimization; offline web browsing. Note: This software is not a hacking program and cannot download backend data!
Disclaimer: This service is for personal study, research, or enjoyment purposes only, and is for non-commercial, non-profit use. Users must comply with copyright laws and related regulations and must not infringe upon the legitimate rights and interests of this website and related rights holders. Any risks arising from the use of this tool are the sole responsibility of the user and are not the responsibility of the software itself.
Copyright © 2019-2026 Xiaofeitu Software. All Rights Reserved. Guangdong ICP Registration No. 19111427-2
Tutorial User Manual Website Special