Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

662
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!