Created
February 11, 2014 21:02
-
-
Save rascoop/8944080 to your computer and use it in GitHub Desktop.
Export WebSQL to CSV Locally with force download - http://stackoverflow.com/questions/9279664/export-websql-to-csv-locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testCSV = function(){ | |
var csvData = ""; | |
db.transaction(function(tx){ | |
tx.executeSql('SELECT * FROM grocery', [], function (tx, results){ | |
var len = results.rows.length, i; | |
for (i = 1; i < len; i++) { | |
csvData += results.rows.item(i).itemno + "," + results.rows.item(i).quantity + "\n"; | |
} | |
window.location='data:application/webcsv;charset=utf8,' + encodeURIComponent(csvData); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment