0

I'm trying to fetch data from an API that DOES NOT support CORS.

fetch("https://app.pixelencounter.com/api/basic/monsters/random", {
    headers: {
        Content-Type": 'image/svg+xml;',
    }})
    .then(response => {
            return response.text()
    })
    .then((data) => {
            console.log("Data:", data);
    });

But keep getting the error cors is not supported. How would I disable fetching with cors? I actually don't want to get cors working, cause it's not supported by the server as mentioned here I tried mode: 'no-cors' but like this I can't access the response cause it's type is opaque.

  • 1
    You proxy it though your server – Wiktor Zychla Jan 17 '22 at 17:24
  • So I actually can't fetch it from the frontend? –  Jan 17 '22 at 17:25
  • @TKsomewhat — You asked this 25 minutes ago. The duplicate told you to proxy it through you server and that you couldn't fetch it from the frontend (and why). Don't just delete questions and re-ask them. – Quentin Jan 17 '22 at 17:26
  • @Quentin If i don't get a proper answer, just a question that's not exactly like mine, I do. –  Jan 17 '22 at 17:29
  • You got a proper answer. It explained everything in detail. – Quentin Jan 17 '22 at 17:29
  • Well, instead you could've answered it on the question isntead of letting me search the other answers for just exactly what I need. But whatever. SO is not known for their friendly members. –  Jan 17 '22 at 17:42
  • The answer has big chunky headings to help you find the bits you care about… and it is already written. It's a FAQ. There would be a lot of duplicate content if all the duplicate questions were answered, explicitly, over and over. – Quentin Jan 17 '22 at 17:44
  • And that would be a problem? Questions can't be deleted permanently anyways. –  Jan 17 '22 at 17:45

0 Answers0