Can't use cordova-plugin-file in Chrome : Secu

2019-06-19 19:20发布

问题:

I use latest cordova with browser platform (I do know it is some quite experimental).

I need to read and write in the cordova.file.dataDirectory directory. filePluginIsReady event is correctly fired in Chrome, and I put my read/write action in its callback.

I use cordova-plugin-file (latest), working great with Firefox and Internet Explorer 11, but with Google Chrome, calling window.resolveLocalFileSystemURL always raise this FileError :

code: 2 message: "It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources." name: "SecurityError"

I carefully read cordova-plugin-file README and the quircks about browser and chrome (large quota is granted, filesystem is initialized).

Adding --allow-file-access option to chrome launcher did not help to access filesystem:file:///persistent/.

With the specific code for Chrome in cordova-plugin-file, I was hoping it would work flawlessly. Any clue ?