- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the usage of the cross-origin attribute in HTML5?
The official specification states cross-origin attribute as −
The crossorigin attribute is a CORS settings attribute. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with canvas.
When it is combined with CORS header, it would allow images defined by the <img> element, loaded from foreign origins to be used in canvas. The procedure would be like being loaded from the current origin.
You can use it to solve JavaScript errors like to log js errors −
if (securityOrigin()->canRequest(targetUrl)) { msg = myError; line = myLineNumber; source = sourceURL; } else { msg = "Error!"; source = String(); line = 0; }
Advertisements