XMLHttpRequest Origin null is not allowed Access-Control-Allow-Origin for file:/// to file:/// (Serverless)

前端 未结 9 770
醉梦人生
醉梦人生 2020-11-22 03:30

I\'m trying to create a website that can be downloaded and run locally by launching its index file.

All the files are local, no resources are used online.

Wh

9条回答
  •  隐瞒了意图╮
    2020-11-22 04:08

    For instances where running a local webserver is not an option, you can allow Chrome access to file:// files via a browser switch. After some digging, I found this discussion, which mentions a browser switch in opening post. Run your Chrome instance with:

    chrome.exe --allow-file-access-from-files
    

    This may be acceptable for development environments, but little else. You certainly don't want this on all the time. This still appears to be an open issue (as of Jan 2011).

    See also: Problems with jQuery getJSON using local files in Chrome

提交回复
热议问题