You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/08/12 15:17:19 UTC

[GitHub] [cordova-plugin-file] GitToTheHub opened a new issue #412: File access in Browser?

GitToTheHub opened a new issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412


   Hi,
   
   I want to run my App in a browser (Chrome), but have problems with accessing the files in the same way as on android or ios.
   For example, i want to store data in `cordova.file.dataDirectory`. On Chrome this is `filesystem:file:///persistent/` but when using `resolveLocalFileSystemURL`, i get the error:
   `SecurityError: 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.`
   In the docu I read to execute Chrome with the flag `--allow-file-access-from-files`, but this doesn't help me.
   
   Any Ideas?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Kepro commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
Kepro commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-691473385






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Kepro commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
Kepro commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-691473385


   This is the code that I'm using... have the same issue
   ```
   static async getPersistentFS(): Promise<FileSystem> {
   		if (cordova.platformId === 'browser' || cordova.platformId === 'electron') {
   			return new Promise((resolve, reject) => {
   				window.requestFileSystem(window.PERSISTENT, 0, (fileSystem) => {
   					FilesystemTool.fileSystem = fileSystem;
   					Logger.info('Filesystem opened!', fileSystem);
   					resolve(fileSystem);
   				}, (err) => {
   					reject(err);
   					console.error('Failed open file system', err.toString());
   				});
   			});
   		}
   
   		return new Promise((resolve, reject) => {
   			window.resolveLocalFileSystemURL(cordova.file.dataDirectory, (dirEntry) => {
   				FilesystemTool.fileSystem = dirEntry.filesystem;
   				resolve(dirEntry.filesystem);
   			}, (err) => {
   				reject(err);
   				console.error('Failed open file system', err.toString());
   			});
   		});
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] brodybits commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
brodybits commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-686633181


   I just added the **help wanted** label.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] GitToTheHub commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
GitToTheHub commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-687068181


   Thank you :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] GitToTheHub commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
GitToTheHub commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-672957353


   Wow thank you, i was searching for the place, where the urls are created. Because when i debug the cordova.file-Property, i get only 3 properties, which are filled, the rest ist empty:
   ```
   applicationDirectory: http://localhost:8000/ (string),
   ..
   dataDirectory: filesystem:file:///persistent/ (string),
   cacheDirectory: filesystem:file:///temporary/ (string),
   ..
   ```
   It wondered who adds the "filesystem"-prefix and searched in the file you referenced and found it directly at the beginning of that file:
   https://github.com/apache/cordova-plugin-file/blob/ce4bfa1b9c0cfdb3e8e479a62ea41a41c7c7b53e/src/browser/FileProxy.js#L37
   
   In the comment it says
   ```
   // For chrome we don't need to implement proxy methods
   // All functionality can be accessed natively.
   ```
   It would be so nice if it would work like this :/


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] GitToTheHub commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
GitToTheHub commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-672946562


   Thank you, but I should have written, that I'm using already a local webserver with `cordova run browser`. If I ouput here `cordova.file.dataDirectory` I get the path `filesystem:file:///persistent/`, but cannot resolve it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-672951362


   https://github.com/apache/cordova-plugin-file/blob/ce4bfa1b9c0cfdb3e8e479a62ea41a41c7c7b53e/src/browser/FileProxy.js#L76
   
   I see... the path appears to be hard-coded but I'm not sure why. I would assume the path should look like `filesystem:<origin>/...`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Kepro commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
Kepro commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-691473385






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #412: File access in Browser?

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-672943401


   I'm not very familiar with the browser platform but I do believe it's intended to be ran from a webserver, not from the local file system. The browser has **a lot** of security features in place, and a lot of features are blocked when loading content from the local file system.
   
   You should consider installing a local webserver to test your browser app.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org