K
K
Keyten2015-06-13 18:42:05
JavaScript
Keyten, 2015-06-13 18:42:05

Image::crossOrigin attribute?

Somehow I came across this code in the sources, it seems, processingJS:

if (path.indexOf('data:image/') !== 0) {
      img.crossOrigin = 'Anonymous';
    }

Googling is not particularly eager to give results, what this attribute is, and what it is responsible for. Perhaps someone knows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2015-06-13
@Keyten

I once wrote something on canvas, there was pixel-by-pixel image processing. That is, I took the canvas using the getImageData function and did something there. So, if the image was not on the same server as my site, then some kind of error popped up, this is such a type of protection. So I read on one foreign forum, in order to avoid this error (bypass this protection), then the property crossOrigin of the Image () object must be assigned 'Anonymous'. Maybe I wrote some nonsense, it was a long time ago ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question