Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!