Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving with ajax on client: how?

Status
Not open for further replies.

iwuvc

Technical User
Jan 11, 2006
10
US
Does anybody have a short (or long) example on how to save and load a text file from a client computer using ajax? I will be grateful for any examples/links.
 
What exactly are you trying to do?

AJAX is for sending HTTP Requests, and receiving HTTP Responses directly from client-side code rather than a 'normal' page transition.
 
I found a site that said ajax could be used with javascript to save and load text files on a client computer, but it did not say how. The js I am making used cookies, but I needed more storage than what is allowed for cookies.
 
Client-side script can be used to manipulate files on the client only if the user's security permissions allow it.

If you are merely looking for client side persistant storage then the term "AJAX" is not helping your search.

 
Well then do you another way to save on client without ajax or cookies?
 
Does the data need to persist between "sessions" or just while the client is using the page this current time?
 
Yes, data needs to persist between the sessions.
 
The only way to do what you're trying to accomplish (without cookies) is to use an ActiveX object which restricts you to I.E. only, and only after a security warning box pops up on the user's screen that they have to click OK on. And if they don't click OK (after being warned about the possible security thread - which usually causes them to click Cancel) then your script will not work.

Why would the browsers be limited so much on doing such a mundane task you ask? The answer is very simple - take the question in your original post and replace all instances of "text file" with "virus". You may not have such malicious intentions, but if what you're trying to accomplish was possible, people that did have malicious intentions would run wild.

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
 
The best plan then is to keep the data on the server... perhaps in a database.

It will be more code but has the side benefit of allowing users to reach their data from more than one computer.
 
There is a flash object that can save data to disk. If the user has flash (and many do) you can use that. I don't know how to do it though - I just saw a mention about it.

Better yet, check out a program called AMASS (Ajax MAssive Storage Sub-system) here:
Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top