Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Is there a way to determine if a cross-origin image would taint the canvas without painting it?

I'm writing a script that allows a user to enter an image URL. I'd like to draw it to the canvas - but only if CORS policy allows me to do so without tainting the canvas. Is there a straightforward way of determining whether the image would taint the canvas without first drawing it to a canvas?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Since you've been given the URL, you can simply force the HTMLImageElement's crossOrigin to be set to "anonymous". If the image loads, it won't taint your canvas*, if its error event fired... you won't be able to draw it.

*Well, there is one case where this could still happen: if the image represents an other security threat for the browser, e.g svg images with <foreignObject> in Safari. For these edge cases, drawing on a 1x1 canvas is the only way to know.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda