Is there any way I can save a .txt file in the local storage and load it back in later? I have an file input element in html where I can load in files. The problem is, that when I reload the code I always need to reselect the file...
You can save only content but not files. If you have the possibility to read out the text file on the server and pack it into a json, then you can read out the json on the client side and pack it into your local storage.
If you do not have a server available, you can do this on the client side with: new XMLHttpRequest();. Read the file and save the content in your localstorage. In this sense: localStorage.setItem('MyContentFromTextFile', content)