Is their a cross-origin attribute in HTML5?

Yes, 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.

You can use it to solve JavaScript errors like to log js errors:

if (securityOrigin()->canRequest(targetUrl)) {
   msg = myErroe;
   line = myLineNumber;
   source = sourceURL;
} else {
   msg = "Error!";
   source = String();
   line = 0;

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 29-Jan-2020


Kickstart Your Career

Get certified by completing the course

Get Started