Open In App

HTML <video> crossorigin Attribute

Last Updated : 15 Jul, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML crossorigin attribute is used in the <video> element that supports a CORS request when we tried to fetch out the video files from the third-party servers or from another domain.

Syntax:

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

Attribute Values:

  • anonymous: It has a default value. It defines a CORS request that 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 illustrates the use of crossorigin attribute in the <video> element. It is set to "anonymous" value which retrieved the audio files without passing credentials information.

HTML
<!DOCTYPE html>
<html>

<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>

        <h3>HTML <video>
            crossorigin Attribute</h3>

        <video crossorigin="anonymous" 
            width="400" height="200" controls
            src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190616234019/Canvas.move_.mp4">
            Browser not supported
        </video>
    </center>
</body>

</html>

Output:

Supported Browsers:

  • Google Chrome
  • Edge 18 and above
  • Firefox 74 and above
  • Internet Explorer 
  • Opera 
  • Safari 

Next Article

Similar Reads