Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML <link> crossorigin Attribute

  • Last Updated : 05 Oct, 2021

The HTML crossorigin Attribute in <link> element is used to specifying that supports the HTTP CORS request when fetching or loading the stylesheet or icon files from the third-party server.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<link crossorigin="anonymous | use-credentials">

Attribute Values:

  • anonymous: It has a default value. It defines a CORS request will be sent without passing the credentials information.
  • use-credentials: A cross-origin request will be sent with credentials, cookies, and certificate.



 

Example: Below code demonstrates the use of crossorigin Attribute with the <link> element. 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link id="linkid" rel="stylesheet" 
        type="text/css" href="styles.css" 
        sizes="16*16" hreflang="en-us"
        crossorigin="anonymous">
</head>
  
<body style="text-align:center;">
    <h1>GeeksForGeeks</h1>
    <h2>HTML <link>
        crossorigin Attribute
    </h2>
</body>
  
</html>

Output:

Supported Browsers:

  • Google Chrome 30.0
  • Firefox 13.0
  • Internet Explorer 18.0
  • Opera 12.0
  • Safari 1.0
My Personal Notes arrow_drop_up
Recommended Articles
Page :