Reputation: 10964
I know this is some sort of security issue with chrome not running files it doesnt trust, but would anyone know is there anyway to fix this problem?
Other than running my code on a server.
Thanks.
Upvotes: 4
Views: 2763
Reputation: 3227
Install http-server
globally:
https://www.npmjs.com/package/http-server
This is a really fast way to develop locally. Disabling the file access with the flag will lead you to other bad practices and unexpected situations.
Upvotes: 0
Reputation: 1
If using windows, you can create a shortcut where the "Target" includes the commands (instead of having to run Chrome from the command line:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files
Upvotes: -1
Reputation: 109232
I presume that you're running with a local file. When starting Chrome you can use the --allow-file-access-from-files
flag to make it load local JSON (for example) or --disable-web-security
to disable the security mechanisms altogether.
Note that depending on your version of Chrome these flags may or may not work.
Upvotes: 3