?
Solved

Can Javascript write to a file??

Posted on 2006-10-21
9
Medium Priority
?
226 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 53

Accepted Solution

by:
Ryan Chong earned 500 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 500 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Assisted Solution

by:cup
cup earned 500 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 53

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 500 total points
ID: 17786906
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

649 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