Can persistent local write permissions be deleted with javaScript?

2

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.

    
asked by Frank Mascarell 08.09.2017 в 04:57
source

1 answer

0

The best solution is to use IndexedDB, integrated in HTML5. Everything else was obsolete: cookies and the FileSystem API.

With IndexedDB you do not need to ask for permissions since it is a secure API, with a paradigm completely different from cookies and the File System API. The use of IndexedDB is a little complicated to understand and get used to at the beginning, since its programming is based on transactions with the database, and its object stores. These transactions trigger some events, passing the recovered values.

Below I attach some links that I myself use to inform me in more detail:

link

link

link

link

    
answered by 30.11.2017 / 21:22
source