javascript - XMLHttpRequest cannot load local destop file in html -


i have json file in desktop folder , try access in html file following error.

xmlhttprequest cannot load file://localhost/users/p41technologies/desktop/json%20in%20html/json-data.json. origin null not allowed access-control-allow-origin.

i tryied to,

open -a "google chrome" --args --allow-files-access-from-files

and

open -a "google chrome" --disable-web-security

but didn't work. still same error. why happen , how solve it.

the security feature encountered supposed prevent malicious scripts read local file system.

have looked html5 file/filereader api? there tutorial working demos. may have here.


Comments