Open In App
Related Articles

HTML DOM Link crossOrigin Property

Improve Article
Save Article
Like Article

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() {
            // return  Link crossOrigin Property
            var newVar = document
                .innerHTML = newVar;


Supported Browsers:

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

Last Updated : 22 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials