1

I'm here because I have a very particular problem, but first a piece of background information:

I'm setting up a website that isn't made to run online on a server. It just should run locally on the client's computer being saved on the clients stick, because I wanna avoid being dependent on the internet. Added to that I don't wanna save data using cookies or smth. similar, because I cannot be dependent on the browser or the computer (as already said above: the website is saved on someones stick).

So there's the problem that I want to save user-data in a text-file via javascript. Coming of Java I thought there would be not problem doing that. But after some research I heard that this isn't possible due to security problems (which sounded logically).

But in my case these security problems are not really relevant in view of the facts that it runs locally and is made for a very small group of trusting people (10-15 people).

So is there a way to just put some small user-data in a text-file (theoretically the file could already be created, but empty) in the folder of the website?

MeineHTMLCodes
  • 509
  • 5
  • 19
  • 1
    `save user-data in a text-file via javascript` Well, it *is* possible, it just has to be done manually. (not user friendly). – CertainPerformance May 12 '18 at 05:13
  • Yeah, I heard from that, but I don't wanna do it like that. – MeineHTMLCodes May 12 '18 at 05:15
  • Possible duplicate of [Is it possible to write data to file using only JavaScript?](https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript) – dodov May 12 '18 at 05:21
  • You could create the data and ask the user to save it via a prompt? [Like this.](https://stackoverflow.com/a/34156339/3130281) – dodov May 12 '18 at 05:22

1 Answers1

1

Running a small HTTP server is a working possibility. Name the html file index.html. On Linux, python has a built in HTTP server with python, python -m SimpleHTTPServer. On the Windows systems, I include an HTTP server exe, like HFS, in the same folder. The website can be connected to using localhost. Something like localStorage would work then.

There's probably something better than this, but it worked. http://www.rejetto.com/hfs/