The HTML crossorigin attribute
Quick answer
The HTML crossorigin attribute configures the CORS request used to fetch the resource. It is used on the <img>, <script>, <link>, <video> and <audio> elements.
Overview
The crossorigin attribute configures the CORS request used to fetch the resource. It applies to the <img>, <script>, <link>, <video> and <audio> elements.
It is required to read pixel data from cross-origin images on a canvas and to get detailed error info from cross-origin scripts. It also pairs with integrity for Subresource Integrity.
Syntax
<script src="https://cdn.example.com/lib.js" crossorigin="anonymous"></script>
Values
| Value |
|---|
| anonymous (default when present) | use-credentials |