Cross Origin Request Blocked
See original GitHub issueWhat I Wanted DatArchive.load and read file per https://github.com/datproject/sdk#apiexamples-promise
What I Did
index.js:
// Auto-detects sane defaults based on your environment
// Uses Beaker's APIs if they are if they are available
// DatArchive is the same as Beaker
// https://beakerbrowser.com/docs/apis/dat
const { DatArchive } = require("dat-sdk/auto");
(async function() {
const archive = await DatArchive.load("dat://dat.foundation");
const someData = await archive.readFile("/dat.json", "utf8");
console.log("Dat foundation dat.json:", someData);
})();
browserify -d index.js > test-bundle.js
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="/test-bundle.js" defer></script>
</head>
<body>
<div></div>
</body>
</html>
What I Got
Firefox console output: TypeError: NetworkError when attempting to fetch resource. Firefox can’t establish a connection to the server at ws://localhost:3472/. stream.js:64 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://gateway.mauve.moe/undation/.well-known/dat. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
TypeError: NetworkError when attempting to fetch resource.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
3 Ways to Fix the CORS Error — and How the Access-Control ...
If the frontend domain does not match the value, the browser raises the red flag and blocks the API request with the CORS...
Read more >Firefox 'Cross-Origin Request Blocked' despite headers [closed]
I came across this question having found requests in Firefox were being blocked with the message: Reason: CORS request did not succeed.
Read more >CORS errors and how to solve them - Topcoder
Why is CORS blocked? ... It is to prevent cross-site request forgery. Let's say you log in to facebook.com and your browser stores...
Read more >Cross-Origin Request Blocked: The Same ... - Microsoft Learn
If the CORS configuration isn't setup correctly, the browser console will present an error like "Cross-Origin Request Blocked: The Same Origin ...
Read more >What Is a CORS Error and How to Fix It (3 Ways) - Bannerbear
To get rid of a CORS error, you can download a browser extension like CORS Unblock. The extension appends Access-Control-Allow-Origin: * to every...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that 3 second wait worked great. Thank you!
Closed with:
https://github.com/datproject/sdk/commit/0ba4031d360f51cc977e15b652c0932e6fa5af65