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

666
Vistas
Image saved in blob returns net error::ERR_UNKNOWN_URL_SCHEME Angular

I’m trying to migrate my app from Electron to Angular, my goal is to show an image uploaded by a user and to do this I did this :

page.component.ts

 uploadImageFile(){
    fileDialog({}, files =>{ //I use the fileDialog library that returns a FileList
      if(files[0])
      {
        this.filePath=URL.createObjectURL(files[0])
      return this.sanitizer.bypassSecurityTrustUrl(this.filePath)
      }else{console.log(":/"); return false};
    })
}

page.component.html

img src="{{filePath}}" ngif="filePath" class="image2" width="200" height="250">

But the program returns this error:

WARNING: sanitizing unsafe URL value blob:http://localhost:4200/3f4bdf10-8080-4f4b-ba3f-15a7f85c6d69 (see https://g.co/ng/security#xss)

GET unsafe:blob:http://localhost:4200/3f4bdf10-8080-4f4b-ba3f-15a7f85c6d69 net::ERR_UNKNOWN_URL_SCHEME

Any advice on how to fix it?

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

0

Bypass security and trust the given value to be a safe for style URL and Resource URL

In this case you need to use bypassSecurityTrustUrl which means

a value that can be used in hyperlinks or <img src>

bypassSecurityTrustResourceUrl which means

a location that may be used to load executable code from, like <script src>, or <iframe src>.

I hope you are clear with this solution

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