I have a requirement where i have to save Form data on iPad, This HTML file will have basic information and form for data collection.
I have to design one page template for iPad, with Photo Gallery, Video Gallery and some text related to project.. More like a presentation. This much is possible and we can keep all the file on iPad and user can access then even if they are not connected to internet.
Issue i am facing is that client want to store form related information in offline (Without internet) mode and only way for me to do it is to use local store.
Since i am new to this i would like to know how i can read this data back from the local store and if it is possible to export this to txt file.
http://codepen.io/anon/pen/gPNMYm
var localStorageAPI = {
    // This method may not be needed as we go along
    // the support is becoming better and better day-by-day
    // http://caniuse.com/#feat=namevalue-storage
    // better to be safe than sorry or get script errors :|
    isSupported: function() {
        return window.localStorage;
    },
    setItem: function(key, value) {
        return localStorage.setItem(key, value);
    },
    getItem: function(key) {
        return localStorage.getItem(key);
    },
    // If do not want to build a wrapper like how I did here but implement 
    // setObject() and getObject(), you can create prototype methods on  
    // Storage
    // Storing Objects in HTML5 localStorage : http://stackoverflow.com/a/3146971/1015046 
    setObject: function(key, object) {
        return localStorage.setItem(key, JSON.stringify(object));
    },
    getObject: function(key) {
        return JSON.parse(localStorage.getItem(key));
    },
    removeItem: function(key) {
        return localStorage.removeItem(key);
    },
    clearAll: function() {
        return localStorage.clear();
    }
};
$(document).ready(function() {
    // Check localStorage support
    if (localStorageAPI.isSupported()) {
        var key = 'longForm';
        // on blur of any form field, save the form data to local storage
        $('.form-control').on('blur', function() {
            // this can be cleaned up better to save 
            // only the relevant form data
            // I am saving the entire form data for simplicity
            // convert Form data to Object
            // http://stackoverflow.com/a/17784656/1015046
            var formObj = {};
            $('form').serializeArray().map(function(x) {
                formObj[x.name] = x.value;
            });
            localStorageAPI.setObject(key, formObj);
        });
        // populate existing form data
        var fData = localStorageAPI.getObject(key);
        if (fData) {
            $.each(fData, function(formEle, formEleVal) {
                $('[name=' + formEle + ']').val(formEleVal);
            });
        }
        // delete the local storage key if the form is "successfully submit"
        $('form').submit(function(e) {
            e.preventDefault();
            // AJAX Call to server..
            // Success
            localStorageAPI.removeItem(key);
        });
    } else {
        alert('No Local Storage Support!');
    }
});
I came across this example. http://thejackalofjavascript.com/getting-started-with-client-side-storage/
Besides this localstored is domain based will it work if we open file as html page on ipad ..
I am sure this is not recommended way of doing thing due to 5BM limitation.
Can we somehow store form data on java-script file.
 
    