04
Aug
Javascript Cross-Browser HTML5 Offline Storage Support
By Joseph Montanez
0 Comment

I think HTML5's Offline Dom Storage is a great concept. Instant offline access to all your web applications. Only problem is only the more recent one support this. So I've made a simple javascript library to help unify older browser support as well as anything that has google gears installed.

Download sample project with Library: gorilla3d.js

// Init storage
var storage = new Gorilla3D.Storage();

if(storage.store === false) {
    alert('Sorry we cannot support you, please download a newer browser or add Google Gears to your current browser.');
}

var tasks = ['Go Shopping', 'Wash Car', 'Clean Room'];

// Save the tasks to storage as a json string.
storage.setItem('tasks', tasks.toString());

// Get the tasks from storage
storage.getItem('tasks', function (value) {
    if(value) { 
        tasks = value;
        tasks = eval(tasks);
    }
});

// Delete the tasks from storage
storage.removeItem('tasks');
Documentaion

Current Browser Support
    Firefox 2.*
    Firefox 3.0 
    Firefox 3.5
    Safari 3.1
    Safari 3.2
    Safari 4
    Internet Explorer 8
    Chrome 1.x
    Chrome 2.x
    Anything With Google Gears Support

« Back to my notebook
Next Note > < Previous Note
Comment Pages: 1


esign