- Courses
- HTML
- HTML top level tags
- <link>
- Role of crossorigin in link element
What is the purpose of the crossorigin
attribute in the <link>
element?
The crossorigin
attribute controls how the browser handles cross-origin requests for the linked resource.
The crossorigin
attribute in the <link>
element specifies whether CORS (Cross-Origin Resource Sharing) should be used when fetching the resource. It determines how the browser should handle requests for resources from different origins. The attribute can take values like anonymous
or use-credentials
, affecting whether credentials are sent with the request. This is crucial for security and resource sharing across different domains.
<link rel="stylesheet" href="style.css" crossorigin="anonymous" />