Is there a way to save cookie from a local webpage on computer as a text file? I have a local webpage which has some text data inside, the only way i could save these text was using cookie. I have already tried activeX object to create a text file but its only available on IE. Is there any better way?
Updaet: I have used this code, but it does not work in IE
function download(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
pom.dispatchEvent(event);
}
else {
pom.click();
}
}