Search code examples
htmlgoogle-chromemanifesthtml5-filesystem

How to gain unlimited File System storage on web app


I would like to gain unlimited HTML 5 File System storage on my web page.

I though this could be realized by creating a manifest.json file:

{
    "manifest_version": 2,
    "name": "my-app",
    "version": "0.0.1",
    "permissions": [
        "unlimitedStorage"
    ]
}

And referencing this file on my web page:

<link rel="manifest" href="manifest.json">

However, I still get a Quota Exceeded error whenever I try to create a file:

window.webkitRequestFileSystem(window.PERSISTENT, 0, function(fileSystem) {
        fileSystem.root.getFile('data.json', {
        create: true,
        exclusive: true
    },
..);

Since defining a manifest file was always mentioned in the context of creating a Chrome extension, I am not sure this actually works on a web page.

  • So, is it possible to define a unlimitedStorage option for HTML 5 File System on a web page?
  • If not, what seems like the best alternative? Just defining a huge size?

EDIT

I am trying to get umlimited storage for my application. Currently, the needed storage size must be defined via the second parameter when calling webkitRequestFileSystem.


Solution

  • There is a difference between web application manifests and the manifest.json files used by Chrome apps and extensions.

    Web application manifests are referenced by a web page with the <link rel="manifest" href="manifest.json"> html you used. They are a way to specify general information about an application, such as its name and icons.

    Chrome apps and extensions also use manifest files, which follow a specific format used by the Chrome platform. Among the things you can define are permissions such as unlimitedStorage, which allows the the app or extension to have an unlimited storage quota for certain HTML5 client-side data.

    So you are correct that the unlimited storage permission is only available for Chrome apps or extensions, and you should just use a large number with webkitRequestFileSystem, such as 1024*1024*10 (10MB).

    See Managing HTML5 Offline Storage for more information.