can anyone who uses .json for their site explain how to get around the damn CORS policy: No 'Access-Control-Allow-Origin' error while running ur site locally? i am at my wits end
allow-file-access-from-file fails if a Chrome was already open in the bg or if Chrome ignores/restricts the flag. Cleanest fix is to serve your folder over http://localhost using a tiny local web server instead of opening HTML files directly or using Chrome flags. Cmd + Q, then open Terminal, type cd and press return. running ls in terminal lists your index.html and .json files. Run python3 -m http.server 8000.
If you're using vscode you could use this extension: https://marketplace.visualstudio.com/items?itemName=yandeu.five-server
It basically does what the comment above says. It starts a local server with the folder you've selected. You just have to click a button instead of typing a command. Also it automatically refreshes the page every time you save changes.
'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-file' in the terminal didn't seem to do it for me ๐ญ
allow-file-access-from-file fails if a Chrome was already open in the bg or if Chrome ignores/restricts the flag. Cleanest fix is to serve your folder over http://localhost using a tiny local web server instead of opening HTML files directly or using Chrome flags. Cmd + Q, then open Terminal, type cd and press return. running ls in terminal lists your index.html and .json files. Run python3 -m http.server 8000.
Then just open your page after verification. It should look normal in chrome when you do it via localhost.
If you're using vscode you could use this extension: https://marketplace.visualstudio.com/items?itemName=yandeu.five-server It basically does what the comment above says. It starts a local server with the folder you've selected. You just have to click a button instead of typing a command. Also it automatically refreshes the page every time you save changes.
yessss thank u guys, i will try n see them both