Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About HTML5 offline storage

Tags:

html

firefox

I have a few questions regarding HTML5 offline storage, which I could not figure out.

  1. Where exactly these files are stored in the Windows? I could not find here:

    C:\Documents and Settings[User Name]\Application Data\Mozilla\Firefox\Profiles\

  2. Is there any expiration time, after that browser deletes these files automatically? Or do the files remain forever?

  3. What if I change the contents of the page, is there anyway to refresh the refresh the data which is stored offline?

Thanks.

like image 972
Roman Avatar asked Aug 02 '11 05:08

Roman


People also ask

What is HTML5 offline storage space?

HTML5 introduced many storage APIs that let you store a large amount of data locally in your users' browsers. But the amount of space allocated for each app is, by default, restricted to a few megabytes. Google Chrome lets you ask for a larger storage quota, beyond the previous limit of just 5 MB.

What is HTML5 storage?

What is HTML Web Storage? With web storage, web applications can store data locally within the user's browser. Before HTML5, application data had to be stored in cookies, included in every server request. Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance.

Where is HTML5 local storage located?

From the JavaScript code, HTML5 local storage may be accessed through a localStorage object on the global window object. The localStorage object stores the data without any expiration date. The data is not wiped, even after closing the browser, and may be accessed at any time.

How many types of data storage are there in HTML5?

The two storages are session storage and local storage and they would be used to handle different situations.


2 Answers

  1. I found them in %AppData%/Profiles/<currentprofilename>.default/OfflineCache. I'm using Windows 7.

  2. This depends on the expires headers your web server sends for the files in question. It is recommended you set the expires header to one week, but it is up to you, you can make it never expire. Note that the manifest file itself should be set to never be cached.

  3. In order to refresh the data you must actually change the manifest file. It is recommended that somewhere in the manifest file you put a comment with the version number, then update it every time you change any of your other files.

Edit: I had answered these questions thinking you meant offline application cache, not local storage.

like image 181
Gaurav Avatar answered Sep 22 '22 11:09

Gaurav


Well, for the sake of accuracy, it should be mentioned that although localStorage was indeed part of the HTML5 specification, it was split into its own after getting slightly over-complicated to be include alongside with the rest of HTML5.

  1. It really depends on your browser, but it should be found on your AppData folder, in /profiles//OfflineCache. (for Windoes 7).

  2. There is generally NO expiration date for localStorage, it can remain forever unless specifically removed by the website.

  3. Javascript changes the localStorage data, (assuming you don't touch the actual file), in which case, the website you are using (or writing) needs to be smart enough to refresh the localStorage along with the page's content.

like image 25
Madara's Ghost Avatar answered Sep 23 '22 11:09

Madara's Ghost