Cordova: Launching chrome with --allow-file-access-from-files from VS 2017

巧了我就是萌 提交于 2019-12-05 09:49:25

Some Chrome Quirks are:

  • Chrome filesystem is not immediately ready after device ready event. As a workaround you can subscribe to filePluginIsReady event. Example: javascript window.addEventListener('filePluginIsReady', function(){ console.log('File plugin is ready');}, false); You can use window.isFilePluginReadyRaised function to check whether event was already raised.
  • window.requestFileSystem TEMPORARY and PERSISTENT filesystem quotas are not limited in Chrome.
  • To increase persistent storage in Chrome you need to call window.initPersistentFileSystem method. Persistent storage quota is 5 MB by default.
  • Chrome requires --allow-file-access-from-files run argument to support API via file:/// protocol.
  • File object will be not changed if you use flag {create:true} when getting an existing Entry.

Form above quirks use basic steps here:

At the time of writing this article, Google Chrome has the only working implementation of the FileSystem API. A dedicated browser UI does not yet exist for file/quota management. To store data on the user's system, may require your app to request quota. However, for testing, Chrome can be run with the --unlimited-quota-for-files flag. Furthermore, if you're building an app or extension for the Chrome Web Store, the unlimitedStorage manifest file permission can be used in place of requesting quota. Eventually, users will receive a permission dialog to grant, deny, or increase storage for an app.

You may need the --allow-file-access-from-files flag if you're debugging your app from file://. Not using these flags will result in a SECURITY_ERR or QUOTA_EXCEEDED_ERR FileError.

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