How to use persistent storage of the HTML5 FileSystem API within webview?

377 views
Skip to first unread message

Dirk Müller

unread,
Feb 8, 2017, 8:17:26 AM2/8/17
to Chromium-Apps-Announce
Is it possible to use persistent storage of the HTML5 FileSystem API from within a webview element?

We built a simple Chromium app, that consists mainly of a HTML file containing a webview element:

<webview src="http://{Host}/index.html" style="width:640px; height:480px" partition="persist:test"></webview>

The manifest.json sets permissions for the webview and unlimitedstorage:

"permissions": [
   "storage",
   "unlimitedStorage",
   "webview"
],
"webview": {
   "partitions": [
      {
         "name":"test",
         "accessible_resources":[""]
      }
   ]
}

We also added an event handler for the permission request to the webview and proved that this code is hit:

webview.addEventListener('permissionrequest', handlePermissionRequest);

function handlePermissionRequest(event) {
   if (event.permission === 'filesystem') {
      // This is called on every request to requestQuota()
      event.request.allow();
   }
}

It's possible to allocate and use temporary storage from the HTML5 FileSystem API in index.html (loaded from http://{Host} into the webview), but we are not able to request any byte of persistent storage. We use this code to test it:

navigator.webkitPersistentStorage.requestQuota(1024, persistentStorageGranted, errorHandler);

function persistentStorageGranted(grantedBytes) {
   // grantedBytes equals 0
   window.requestFileSystem(window.PERSISTENT, requestedBytes, onInitPermanent, errorHandler);
}

Should it be possible to allocate persistent storage (HTML5 FileSystem API) from within the webview element?

Thank you for your help.

George Pavlovich

unread,
Mar 30, 2018, 1:16:51 PM3/30/18
to Chromium-Apps-Announce
My use case is exactly as above. Has anyone had success using persistent storage of the HTML5 FileSystem API from within a webview element?  My web page (which saves most of its content to the filesytem for offline use) calls navigator.webkitPersistentStorage.requestQuota and receives nothing. When using the event handler suggested above, A webview event 'permissionrequest' is not registered. 

I am attempting to launch my page on a managed chrome device using Single App Kiosk mode which requires a Chrome App which only displays web content in a webview tag. Am I dead in the water?

Great thanks and praise to anyone who can help.
Message has been deleted

PhistucK

unread,
May 30, 2019, 1:40:06 AM5/30/19
to Alireza Jahandideh, Chromium-Apps-Announce
Note that Chrome applications are not abandoned on Chrome OS. They are only abandoned on Windows, macOS and Linux.

PhistucK


On Thu, May 30, 2019 at 8:23 AM Alireza Jahandideh <ar.jah...@gmail.com> wrote:
I am stuck here too!

Please 
either provide a way to use installed PWAs in kiosk mode in Chrome OS instead of (abondened) Chome Apps 
or let us know how we can provide unlimited storage to a trusted PWA loaded via webview

:-(

--
You received this message because you are subscribed to the Google Groups "Chromium-Apps-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-apps/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-apps/5a854f06-b6e5-485f-9dc3-6ed504dba7b8%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
Reply all
Reply to author
Forward
0 new messages