I have a probelem - how to save information as a txt or js file and retrieve it later using only html or javascript .

Recommended Answers

All 4 Replies

Hi,

It can't possible to save and retrieve the data by using Script or JSP without having any internal databases. But u have an optoin can use PHP instead of Script or JSP file. I think it was better .


Thanks & Regards,

Jayavardhan Tummidi.


We have an other option to save the text information by using javascript or html. That was, First u write a code in either html or javascript, When you click on the submit button, make that text information converted into either word or excel. So, that you can easily store that word or excel documents and also u can retrieve it back.


Thanks & Regards,

Jayavardhan Tummidi


Or another option is to get javascript to store the information in a cookie. It is possible for javascript to make its own cookies containing up to 4KB of data.

how to save information as a txt or js file and retrieve it later using only html or javascript .

If
1. the user has IE (or another browser that supports ActiveX plugins)
and
2. the user responds 'OK' to the security warning(s)
then something like this

function WriteToFile() {
    var xFSO = new ActiveXObject("Scripting.FileSystemObject");
    var xFN = xFSO.CreateTextFile("whatever.htm", true);
	var oHtm = document.getElementsByTagName('html')[0]
    xFN.WriteLine('<html>'+oHtm.innerHTML+'</html>');
    xFN.Close();
}

is all it takes.

Otherwise, not possible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.