I have built a WebView application that stores some information in DOM storage (localstorage). As part of the application, I would like to export that data either to a .csv file or to an email (attached as .csv, etc).
I'm able to get the data in a .csv format, but I'm not sure how to export or send an email with the data.
Upon clicking the "Export" button, I have tried the following:
var currentData = getHistorySummary("myObject");
var dataArray = [];
for (var i = 0; i < currentData.length; i++) {
dataArray.push(JSON.parse(currentData[i]));
}
dataArray.sortBy('id');
var csv = convertJSONtoCSV(dataArray);
var csvContent = "data:text/csv;charset=utf-8,";
csvContent += csv;
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "my_data.csv");
window.open(encodedUri);
However nothing happens at this point, and I receive the following warning:
Cannot call determinedVisibility() - never saw a connection for the pid: 27146
Is there a better way to "export" this information, or am I missing something?