Skip to content
Related Articles

Related Articles

HTML DOM Link crossOrigin Property

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 29 Mar, 2022

The HTML DOM Link crossOrigin property is used to set or return the value of the crossorigin attribute of the <link> element. This attribute is used for specifying the HTTP CORS request when fetching or loading the stylesheet or icon files from the third-party server. 



  • It returns the cross-origin property.
  • It is used to set the cross-origin property.
linkObject.crossorigin="anonymous | use-credentials;

Property 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 1: Below HTML code returns the link cross-origin property. 


<!DOCTYPE html>
    <link id="linkid" rel="stylesheet" type="text/css" 
        href="styles.css" sizes="16*16" 
        hreflang="en-us" crossorigin="use-credentials">
<body style="text-align:center;">
    <h1 style="color:green">
    <strong>DOM Link crossOrigin property</strong>
    <button onclick="myClick()">
    <p id="pid" style="font-size:25px;color:green;"></p>
        function myClick() {
            // Access link element.
            var newVar = document
                .innerHTML = newVar;


Supported Browsers:

  • Google Chrome
  • Mozilla Firefox
  • Edge
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!