4

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.

C--
  • 16,393
  • 6
  • 53
  • 60

1 Answers1

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