Solved

Can Javascript write to a file??

Posted on 2006-10-21
9
210 Views
Last Modified: 2008-01-16
I would like to have javascript write to a flat file that's on the server. Is this possible? What are the commands if it is? I'm working with a particular server that can only run html pages and doesn't have any programming languages installed like ASP or PHP.
0
Comment
Question by:bemara57
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 125 total points
ID: 17781028
>>I would like to have javascript write to a flat file that's on the server. Is this possible?
NO for javascript, but yes for Java Applet/ActiveX Control or Server Side Scripting Languages.
0
 
LVL 41

Assisted Solution

by:HonorGod
HonorGod earned 125 total points
ID: 17781677
Not in client side, yes for server side Javascript
0
 
LVL 12

Expert Comment

by:jessegivy
ID: 17782788
what is it you're trying to accomplish?  perhaps a file isn't best solution?  if client side solution is required you could use cookies, but I'm sure you've got other options.

Cheers,

Jesse
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 11

Assisted Solution

by:cup
cup earned 125 total points
ID: 17782970
If you are working in a windows environment, yes.  On the client side, it depends on whether Javascript is enabled and whether your browser allows it.

var fso, src, srcstr
fso = new ActiveXObject ("Scripting.FileSystemObject");
dst = fso.OpenTextFile ("the file", 2);  // 1 = read, 2 = write, 8 = append
dst.Write ("some text");
dst.close ();
0
 

Author Comment

by:bemara57
ID: 17784144
but this will write onto a file that resides on the client side correct? What I'm trying to accomplish is having a flat file that keeps count of all the hits on specific pages. The only hurdle to this is that the server i'm working with cannot have a server side scripting language installed nor MySQL installed. Its a bare naked server that has to stay that way for corporate reasons. So all I have to work with is html and javascript. Its using apache on unix if that helps.. but I just can't install anything more than that.
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 17784159
If your server is so limited that doesn't allow you to use some way to write info into it, we're sorry that we may also can't help you here..

The alternative way may be is to use FTP transfer method... you may FTP your latest info into your server, and when your user read those info from some where else, hopefully what he/she saw is the latest info, but this will be the last resource (backup plan) I can suggest to you.

>>What I'm trying to accomplish is having a flat file that keeps count of all the hits on specific pages.
Depends on what Web Server you're using, you may already have a Log generated from each hit count. Try check this with web administrator, to see whether the Web Server Log is available by default or not?
0
 
LVL 12

Assisted Solution

by:str_kani
str_kani earned 125 total points
ID: 17786906
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question