Possible Duplicate:
window.requestFileSystem not working
Following is the code to generate a csv file using any data from HTML page. In my case, I hvae a variable history in which I have data collected from a HTML table.
By this code, I can download the generated csv file in my computer. this code is working fine in Google Chrome but not in Firefox. I need to run it in firefox too.
This code is from HTML5
You can try this code here
window.webkitRequestFileSystem(window.TEMPORARY, 1024*1024, function(fs) {
fs.root.getFile('history_tracker.csv', {create: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
var builder = new WebKitBlobBuilder();
builder.append(history);
var blob = builder.getBlob('text/plain');
fileWriter.onwriteend = function() {
window.open(fileEntry.toURL());
};
fileWriter.write(blob);
}, errorHandler);
}, errorHandler);
}, errorHandler);
}
function errorHandler(e) {
var msg = '';
switch (e.code) {
case FileError.QUOTA_EXCEEDED_ERR:
msg = 'QUOTA_EXCEEDED_ERR';
break;
case FileError.NOT_FOUND_ERR:
msg = 'NOT_FOUND_ERR';
break;
case FileError.SECURITY_ERR:
msg = 'SECURITY_ERR';
break;
case FileError.INVALID_MODIFICATION_ERR:
msg = 'INVALID_MODIFICATION_ERR';
break;
case FileError.INVALID_STATE_ERR:
msg = 'INVALID_STATE_ERR';
break;
default:
msg = 'Unknown Error';
break;
};
}