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

224
Visualizações
LocalStorage does not work on mobile?

I'm using localStorage to back up form data on a long form. So if a user refreshes they will not lose everything. This is working perfectly on Chrome & Firebox on the computer.

However on mobile (iOS at least) It's not working at all. Any advice?

Here is a small part of my code as an example:

Storing Data:

 window.onbeforeunload = function() {
       window.localStorage.setItem("Job1", $("#topScore1B").text());
    }

Retrieving Data:

window.onload = function() {
    //   If values are not blank, restore them to the fields
        var name = window.localStorage.getItem('Job1');
        if (name !== null) $('#job1').text(name);


}
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The beforeunload event does not fire on iOS.

It looks like unload does fire, so try storing your data into local storage there instead.

Alternatively, you could store data into local storage as the user edits the form (ie when each input fires change), which comes with the added bonus of storing the entered data even if the browser crashes before the user finishes.

about 4 years ago · Santiago Trujillo 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