Solved

Can Javascript write to a file??

Posted on 2006-10-21
9
207 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
9 Comments
 
LVL 49

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now