-2

I have an HTML file bundled with js and CSS.

There is a form table with input fields so when user enters the data it should be saved permanently . i cannot use local storage or any web based or system storage because the html file needs to be send within PC so that different user can enter the remaining data .

also cannot use any db or store it in server because the client is using system that doesn't have internet connection .

i tried setting the data to html element but on refresh it's lost. i need data to persist even after refresh.

so is there any method to store data in html file itself

is it possible to do this?

if any other methods plz recommend

MTAS
  • 17
  • 5
  • This isn’t possible in html, you would need local storage or cookies or session storage, and if you want to rewrite the page you would need to write php for that but it would still need internet to change the page contents and save them so it is not doable – Bobby Mannino Jun 28 '22 at 09:27
  • thanks . but to rewrite to same html file is there any way ? just by using js only – MTAS Jun 28 '22 at 10:29
  • What does "...the html file needs to be send within PC..." mean? The file is transferred from one computer to another computer? – bloodyKnuckles Jun 29 '22 at 00:54
  • yes , file needs to be transferred to different computers and none has internet access – MTAS Jun 29 '22 at 06:24

1 Answers1

0

You could check out this answer and see if that works for you.

In general, your web browser is not an HTML editor, meaning you cannot open an HTML file, make some kind of change, and then expect the change to be reflected in the original file.

What you could try is using HTML to render a form with a submit button that simply "downloads" a new HTML file. Then you can use the new downloaded file as your new version and get rid of the old version. Depending on your use case, this might work for you.

nullromo
  • 2,165
  • 2
  • 18
  • 39