Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
Saving Local Application Settings

Is there any way to safely retain/save data (settings) other than IndexedDB and manual saving (prompt the user with a dialog box to save)?

Basically I am writing an offline application and will be bundled and deployed as a local html file (e.g. file:///D:/test/index.html, no servers, just run by double-clicking the html file). It will have some settings and I need to be able to save these settings locally. The first time the app boots up, I retrieve the settings from a app-settings.json file and save it to IndexedDB.

However, my problem is that when the user clears the browser data, the settings will be deleted as well.

I do not want to prompt the user with a dialog box asking to save the app-settings.json everytime an update is made to the settings. (It would also be prone to duplicate, misplaced settings)

Any suggestion on how to go about this? How can I safely retain the application settings without any servers? Maybe there is an offline database of some sort that can be used in scenarios like this?

Would appreciate any help here! I'm desperately out of ideas :(

Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

// Check if site's storage has been marked as persistent
if (navigator.storage && navigator.storage.persist) {
  const isPersisted = await navigator.storage.persisted();
  console.log(`Persisted storage granted: ${isPersisted}`);
}

please enable persistent storage by enabling navigator.storage.persist, and I would suggest start using service workers to manage offline applications.

https://web.dev/persistent-storage/ https://developers.google.com/web/fundamentals/primers/service-workers

about 4 years ago · Juan Pablo Isaza Relatório

0

You Can use the Use the Javascript File Api https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API

The dialog to save the file will be shown once, Then reading the file will not require a file dialog.

BTW

VS Code web also uses the api: https://vscode.dev/

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda