A
André Wagner
Hello,
I'm writing a HTML/javascript application who will run locally. I want
to save to a local file.
If I were using IE, I would do this way:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fspenTextFile(filePath,2,-1,0);
file.Write(content);
file.Close();
If I were using Mozilla, I would do like this:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if (!file.exists()) file.create(0, 0664);
var out =
Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file, 0x20 | 0x02, 00004,null);
out.write(content, content.length);
out.flush();
out.close();
But I couldn't figure out how to do it using Opera. Does anyone has any
idea?
Thank you in advance,
André
I'm writing a HTML/javascript application who will run locally. I want
to save to a local file.
If I were using IE, I would do this way:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fspenTextFile(filePath,2,-1,0);
file.Write(content);
file.Close();
If I were using Mozilla, I would do like this:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if (!file.exists()) file.create(0, 0664);
var out =
Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file, 0x20 | 0x02, 00004,null);
out.write(content, content.length);
out.flush();
out.close();
But I couldn't figure out how to do it using Opera. Does anyone has any
idea?
Thank you in advance,
André