I'm developing an addon for Firefox browser. My addon is intended to work on Linux platform specifically. How can I handle a file in Javascript on Linux? I've Googled a lot on this and all I got was file handling in Javascript on Windows using ActiveX objects. Is there any way to do the same on Linux? The type of file I wanted to create and handle is just text.
Asked
Active
Viewed 2,388 times
1 Answers
3
The Mozilla Development Center has some really great reusable XPCOM components for managing files. Check out the nsIFile component documentation below:
Reading, writing files: https://developer.mozilla.org/en/Code_snippets/File_I//O#Navigating_with_.0ansIFile
General information on nsIFile: https://developer.mozilla.org/en/Code_snippets/File_I//O#nsIFile_and_path_strings
In short, when developing a Firefox Add-on, your JavaScript has special permissions when loaded in the XUL markup using a "chrome URL". This JavaScript can read and write to the filesystem natively, for Windows, Mac, and Linux. Thus, there is no need to use Flash or any third-party plug-ins.

jamesmortensen
- 33,636
- 11
- 99
- 120
-
meh, that's for extensions, but not for web pages. – J-16 SDiZ Jan 20 '11 at 02:38
-
1@J-16 SDiZ - Doesn't the OP's question indicate that he's writing a Firefox Extension/Add-on? – jamesmortensen Jan 20 '11 at 02:47