I'm testing the persistent storage of the FileSystem API. I have tried how the application requests permissions from the user, with an alert type window, but it only comes out the first time, as is logical, after accepting permissions. In a development environment, I would like to try this topic several times, that is, every time the application starts, it will erase the permissions first, so that it can be requested again. Can this be done? Here is the code:
<script type="text/javascript">
// Solicitar permisos al navegador.
navigator.persistentStorage = window.persistentStorage || navigator.webkitPersistentStorage;
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
navigator.persistentStorage.requestQuota(1024*1024*10,
function(grantedBytes){
// Tras recibir permisos para almacenar archivos,
// se solicita un punto al fileSystem
window.requestFileSystem(PERSISTENT, grantedBytes, onInitFs, errorHandler);
}, function(e){console.log("Error: ", e);}
);
// Crear un archivo y escribir en el
function onInitFs(fs){
// Creamos el archivo en el fileSystem
}
function errorHandler(){
}
</script>
An intermediate solution is that every time you try the application, increase the size of space requested, then when requesting more space, again ask for permission, but it is a very rough solution.