Sign in to follow this  

[web] File IO with Firefox ?

This topic is 3842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello: This maybe newbie question, but I would like to read in a flat text file form FireFox in order to run a test based on the content of that text file. Is there a simple example of doing this some once can provide? Also, I will need to write out the results of running the test, which I would suspect would be available along the same lines as well. Help appreciated, thanks, L-

Share this post


Link to post
Share on other sites
That's not a lot of info so I'm assuming the basics here...

You need this to run server-side (at the Internet provider or run a local web server). Understanding the basics of CGI (Common Gateway Interface) is a good start if you don't already. Find out what your Internet provider supports such as PHP, Perl, ASP, ASP.NET, etc. Local file IO straight from the browser through javascript just isn't possible due to security issues. You could use the HTTPRequest object through ActiveX if you're using XML but it would still have to be server-side if you wanted to write to it.

Once you know what server-side language you are using, let us know and I'm sure we could be of more help.

Share this post


Link to post
Share on other sites
You can't read local files from javascript in unprivileged code in Mozilla.

If you are writing some privileged javascript code (e.g. an extension or something), then it is possible to read/write files, using something like:


var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("/tmp/test.txt");


But you probably won't want to do this.

Mark

Share this post


Link to post
Share on other sites
thanks coderx75
i hawe similar problems with ie.
request object gives error...">>ACCESS DENIED<<" on ie...?
when i try to get content...

on all pages which are public...
i cannot understand whay...
they are public...

can you help me...?

Share this post


Link to post
Share on other sites
You cannot request files across domains. Even requesting a file on www.example.com from a site being viewed at example.com will not work! You must request files from the same domain that the javascript source code is running from!

Share this post


Link to post
Share on other sites
isnt it possible with childs or any other way on html.
i do not using firefox but it isnt important.

also sory about asking on your topic.. Lucidquiet ...
...
also is firefox realy open source...
like open source c...?
generally i can't found any open source which is open source...?

[Edited by - RSC_x on June 23, 2007 6:33:18 AM]

Share this post


Link to post
Share on other sites

This topic is 3842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this