I am creating a web application called List Maker in JavaScript, and one of the functions is to be able to export / import data from JSON. For exporting and importing JSON data, a popup will be displayed allowing the user to copy / enter data.
However, I am having trouble showing the popup, as I keep getting this error:
[Exception... "The operation is insecure." code: "18" nsresult: "0x80530012 (SecurityError)" location: "<unknown>"]
Here's the function that displays the popup:
function JLShowExportDialog()
{
var w = window.open('', '', 'width=400,height=400,scrollbars');
w.document.write(document.getElementById("exporttojson").innerHTML);
w.document.body.style.fontFamily = "sans-serif";
w.document.getElementById("jsontext").innerHTML = GetJSONFromList();
w.document.title = "Export List To JSON";
w.document.close();
}
And the exporttojson
div:
<div id="exporttojson" style="display: none">
<h1>Export to JSON</h1>
<p>The text in the box below contains the JSON.</p>
<textarea id="jsontext">
</textarea>
</div>
The code for the GetJSONFromList()
function:
function GetJSONFromList()
{
return JSON.stringify(LMList);
}