on the client computer.
Actually, the objects needed are often found in the browsers, and the rest is only a matter
of compatibility (the way IE saves files is very different from the way Firefox saves files...)
and of permissions.
In order to perform critical file-system operations, the script must be granted privileges.
There are different ways to get these privileges, and unfortunately, these are very different
depending on the browser your application run on.
I won't debate long on the subject of security and permissions in the browser, others did that much
better than me (check Google for more information). The demo here demonstrates as a proof of concept
that saving a file locally is possible in both major web clients available today (IE and Firefox,
tested only on Windows platform).
A few things before you start
In the http protocol (i.e. without
locally), this demo will most probably fail in Firefox. In IE, however, it may work, depending
on the permissions you set for the Internet zone.
This demo is a proof of concept only.
I usually use these methods either in HTA applications (running locally, granted extended privileges
by IE), or in the "file:" protocol. This is what they have been designed for.
The code has been tested on IE6 on Windows XP and in Firefox 22.214.171.124 on Windows XP.
The code for Netscape 4.7 is provided in the file
reference and for historical reasons. However, the use of keywords like "try", "catch", "throw" make
this demo fail in Netscape 4. This is why the code has been commented out of the demo.
I accept no responsibility whatsoever for changes
you might apply to this code and which might harm your computer.
About the "gslb" namespace
object named "gslb" (for GalaSoft Laurent Bugnion).
The purpose of such a "namespace" is to avoid polluting the global object with too many names,
and to avoid name collisions.
On the downside, it is necessary to reference each call to the object with the full name,
oExplorer = new gslb.CExplorer();