Why does this filesystem api requestQuota call fail?

你说的曾经没有我的故事 提交于 2019-11-28 11:38:39

Not sure this is the best answer but it appears to be a security restriction on local files. Starting Chrome as below fixes the issue:

google-chrome --allow-file-access-from-files

That will allow creating persistent storage.

Andrew Willems

If your app requires the user to double-click on an html file, then your answer might be the only way to go. However, if the need is to access a local file, but you have some flexibility in terms of how to access that local file, then consider creating a small local server.

On Windows, install http-server (npm install -g http-server) and run http-server from your project directory. On Mac/Linux, run python -m SimpleHttpServer from your local directory. In the browser, access the locally hosted web site. On Windows I had to use localhost:8080 while on the Mac I had to use localhost:8000.

All credit for this answer goes to @orszaczky who gave this answer to another SO question. That answer also discusses why this is a security issue, and why using the --allow-file-access-from-files flag is potentially dangerous.

By the way, this is not only an issue for Chrome (v49.0) but also for Opera (v35.0), on both Windows and Mac.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!