Solved

Can Javascript write to a file??

Posted on 2006-10-21
9
209 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 51

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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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 51

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JS does not refresh 6 30
How to deal with the query string 8 37
forgetful about js objects 8 47
Button on Table, name table1 not working 4 22
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

830 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