Open In App

HTML DOM Video crossOrigin Property

Last Updated : 11 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML DOM Video crossOrigin property is used to set or return the value of the crossorigin attribute of the <video> 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.

Syntax:

  • It returns the cross-origin property.
videoObject.crossOrigin;
  • It is used to set the cross-origin property.
videoObject.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 video cross-origin property.    

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        DOM Video crossOrigin Property
    </title>
</head>
 
<body style="text-align: center">
 
    <h1 style="color: green"> GeeksforGeeks</h1>
    <h2 style="font-family: Impact">
          Video crossOrigin Property
      </h2>
    <br>
 
    <video id="Test_Video" width="360" height="240"
           src="sample video.ogg" crossOrigin="anonymous"
           controls>
    </video><br>
 
    <button ondblclick="My_Video()">
        Return
    </button>
 
    <p id="test"></p>
 
 
 
    <script>
        function My_Video() {
            var cors = document.getElementById("Test_Video").crossOrigin;
            document.getElementById("test").innerHTML = cors;
        }   
    </script>
 
</body>
 
</html>


Output:

 

Supported Browsers: The browser is supported by DOM  video crossOrigin Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads