Jump to content

How to write to a text file using javascript


Guest Teddy4z

Recommended Posts

Javascript has no support for reading or writing files on either the server or local system. There are a couple of sketchy work arounds for IE using jscript and ActiveX but they're generally not very reliable and aren't cross browser. The exception is cookies which you can both read and write. This will be fine if you want to store some value or setting for each user, which you can reload on their next visit. Read the JS Cookies article for how to use them.

Link to comment
Share on other sites

Javascript has no support for reading or writing files on either the server or local system. There are a couple of sketchy work arounds for IE using jscript and ActiveX but they're generally not very reliable and aren't cross browser. The exception is cookies which you can both read and write. This will be fine if you want to store some value or setting for each user, which you can reload on their next visit. Read the JS Cookies  article for how to use them.

There you go...wrong again :) ... keeps me humble, lol
Link to comment
Share on other sites

You could read a text file (would be cross browser) if you set the src of a hidden iframe to the path of the text file then read the ocontents of the frame.As far as writeing ot a file you would need ActiveX which as was said is not cross browser.

Link to comment
Share on other sites

I would use php for this, infact It sound's a little like you want to do something fairly similar to something I've done myself with php. Could you post this question in the php forum and give a little more details about what exactly you are trying to acheive?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...