axios gives me a CORS error, fetch doesn't. Why is that?
NODE
Access to fetch at 'https://example-29544e.webflow.io/' from origin 'http://127.0.0.1:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. fetcher.js?v=36de8185:44 GET https://example-29544e.webflow.io/ net::ERR_FAILED 200DENO This seems to fetch the data just fine. Interestingly, using the above approach in Node produces another CORS error. I'm confused
44 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Is there any way to ignore cors in node fetch?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Then how do people usually fetch the data in those sort of scenarios?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I will try the sveltekit deno adapter and see if I can get it to work there
Quick question, I just created a demo project with
deno init
added index.html
and added the main.ts
to the html head via <script src="main.ts"></script>
but I can't seem to get it to work. I keep getting Refused to execute script from 'http://127.0.0.1:5500/main.ts' because its MIME type ('video/mp2t') is not executable.
in console.
What am I doing wrong?
the dev server was started using the vsc extension live serverUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
It keeps telling me that document is not defined
error: Uncaught (in promise) ReferenceError: document is not defined const el = (document.querySelector('body').innerHTML = bodyContent)and in console
Uncaught SyntaxError: Cannot use import statement outside a module (at main.js:1:1)
Put
type="module"
on your script tag.Thanks, that has gotten of the import error, but document is still undefined
This is in the browser yes?
no, when I run deno run --allow-write --allow-net main.js
Document isn’t defined in deno.
It gives you type information but there is no document in deno. Unlike a html page which is a document.
So how does one interact with the dom?