Skip to content
Related Articles

Related Articles

HTML <img> crossorigin Attribute

Improve Article
Save Article
Like Article
  • Last Updated : 30 Sep, 2021

The HTML crossorigin Attribute in is used in <img> element that supports a CORS request when we tried to fetch out the .png or .jpg files from the third party server or from other domain. 


<img 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 illustrates the use of crossorigin attribute in the <video> element. It is set to “anonymous” value which retrieved the .png or .jpeg files without passing credentials information. 



<!DOCTYPE html>
        HTML img crossorigin Attribute
    <h2>HTML <img> crossorigin Attribute</h2>
    <img src=
        alt="GeeksforGeeks logo" crossorigin="anonymous">


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 :

Start Your Coding Journey Now!