Can javascript access a filesystem?

Joe picture Joe · Jul 6, 2009 · Viewed 49.2k times · Source

I was pretty sure the answer was NO, and hence google gears, adobe AIR, etc.

If I was right, then how does http://tiddlywiki.com work? It is persistent and written in javascript. It is also just a single HTML file that has no external (serverside) dependencies. WTF? Where/how does it store its state?

Answer

Zr40 picture Zr40 · Jul 6, 2009

Tiddlywiki has several methods of saving data, depending on which browser is used. As you could see in the source.

  • If ActiveX is enabled, it uses Scripting.FileSystemObject.
  • On Gecko-based browsers, it tries to use UniversalXPConnect.
  • If Java is enabled, it uses the TiddlySaver Java applet.
  • If Java LiveConnect is enabled, it tries to use Java's file classes.