I am currently creating an offline HTML page that displays a list of elements with checkboxes. but if I close and reopen the page, my checkboxes are all unchecked (normal). so, I created a "save" button, using the "a" element, that looks like this :
var file = new Blob([data], {type: 'application/text'});
var a = document.createElement("a");
url = URL.createObjectURL(file);
a.href = url;
a.download = 'testSaveJson.js';
document.body.appendChild(a);
a.click();
I save my data as a js file and this file is open in a in my HTML, but I was wondering 2 things :
1 - Is there was a way to do this download in a specific location, without having the browser asking where to download the file, and overwrite the previous file if there is already one with the same name ?
2 - is there a better (and reliable) way to save local information about my web page, for example, by using cookies ? is there a risk that my browser loses my data if I do not reopen my page for a long time with this kind of solution ?
I am still a beginner, and this is really for local use only (this page is not designed to work on line and contains links to local files on my computer)
Thanks for your answers