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

267
Views
Fetching image from firebase produces CORS error

So I've uploaded an image onto my firebase, and I'm trying to retrieve it using javascript's fetch.
I've tried the solution here but it produces a CORS error.
I've also tried running python3 -m http.server inside the directory containing the html file but it produces a similar error.
Here's my code:
Index.html

<!DOCTYPE html>
<html>
<body>
    <div id="myImg"></div>
    <script src="script.js"></script>
</body>
</html>

script.js

fetch("https://firebasestorage.googleapis.com/v0/b/mvp1-354320.appspot.com/o/Parts%2F7.jpg?alt=media&token=c2049b23-b406-407c-b39e-86da7fcce764")
    .then(res => res.blob()) // Gets the response and returns it as a blob
    .then(blob => {
        // Here's where you get access to the blob
        // And you can use it for whatever you want
        // Like calling ref().put(blob)

        // Here, I use it to make an image appear on the page
        let objectURL = URL.createObjectURL(blob);
        let myImage = new Image();
        myImage.src = objectURL;
        document.getElementById('myImg').appendChild(myImage)

    });

Here's my error message without running a python server enter image description here

Error message while running python3 -m http.server enter image description here

about 4 years ago · Santiago Gelvez
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!