HTML crossorigin Attribute
CORS stands for cross-origin resource sharing. It is a mechanism by which one webpage requests to another domain for fetching out the resource like audio, video, script, etc from the third party server without leaking their credentials information. If specified, the request will be sent with or without credentials.
The crossorigin attribute is used to define whether to support CORS requests. When fetching out the resources from another domain or from third-party servers. It includes resources like audio. video, images. link and script. It is used to handle the CORS request that checks whether it is safe to allow for sharing the resources from other domains.
- anonymous: It has a default value. It defines a CORS request which will be sent without passing the credential 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 <audio> element.
- Google Chrome 30.0
- Firefox 13.0
- Internet Explorer 18.0
- Opera 12.0
- Safari 1.0