473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Saving local files in javascript under Opera

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 = fso.OpenTextFile(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.nsIFileOutpu tStream);
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é

Apr 24 '06 #1
4 4004
André Wagner said the following on 4/24/2006 1:10 PM:
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 = fso.OpenTextFile(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.nsIFileOutpu tStream);
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?


<h1>Copy and paste this text to your text editor and save it:</h1>
<textarea>Data to be saved here</textarea>

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 24 '06 #2
"André Wagner" <an*******@gmail.com> writes:
I'm writing a HTML/javascript application who will run locally. I want
to save to a local file. ..... But I couldn't figure out how to do it using Opera. Does anyone has any
idea?


Check out TwiddlyWiki (google to find it). They use Java through
Livescript to access files. It needs configuration to allow that, but
it works.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Apr 24 '06 #3
Lasse Reichstein Nielsen <lr*@hotpop.com> writes:
Check out TwiddlyWiki (google to find it).


Which becomes easier if I write the name correctly: TiddlyWiki!
For some reason, my ISP is acting up, so I can't google for it myself :(
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Apr 24 '06 #4


André Wagner wrote:

I'm writing a HTML/javascript application who will run locally. I want
to save to a local file. But I couldn't figure out how to do it using Opera. Does anyone has any
idea?


You could try it using LiveConnect making JavaScript to Java calls. But
I am not sure that works, it might cause Java security exceptions.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mchl gdbt | last post by:
Hi, I have several thousand tiffs generated by application A which are read by application B. I need to remove a few colours from the tiffs and I decided to try with the python imaging library....
1
by: Daniel Orner | last post by:
I've got an online system which I'm interested in making available offline - i.e. letting the user download certain HTML forms, fill them out offline, then the next time he logs into the site,...
1
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and...
26
by: geolev | last post by:
I'm trying to understand the effects of the Daylight Saving Time rule changes for 2007 in the US. Can anyone tell me how Javascript knows when to apply Daylight Saving Time in the following script?...
90
by: charlesmusco | last post by:
Hi all. I have the following problem. I have an xml file, while I will list below and I am trying to add nodes to the xml document based on user input to a form. The XML doc is ... <?xml...
13
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives,...
27
by: RobG | last post by:
I was investigating a function to determine whether daylight saving was being observed on a particular date (given the platform's regional settings) and came across a suggestion at merlyn.com to...
5
by: JohnLorac | last post by:
Hello, can somebody help me with saving file into local disk using javascript? I made some sample code which unfortunately won't work :(. Applet sample file: public class IO extends...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.