Michael Luce
Posts: 0
Joined: Mon May 11, 2015 5:58 pm

localStorage persistance when app is closed?

Hi,

When my app opens I am checking for a localStorage variable that is set when opened (a boolean). The idea is to find out if this is the first time the user has opened the app. If I store a boolean using localStorage, will it persist the next time the app is opened (on iOS)?

var previouslyOpened = localStorage.getItem('Opened');

if (previouslyOpened) {
Apperyio.navigateTo('Logon', {});
} else {
Apperyio.navigateTo('Different_Page', {});
}

Thanks for any advice!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

localStorage persistance when app is closed?

Hello Michael,

Your code is correct. You should just write true into localStorage variable on load event of 'Different_Page'

Michael Luce
Posts: 0
Joined: Mon May 11, 2015 5:58 pm

localStorage persistance when app is closed?

This code does not seem to work correctly when using the appery app for viewing your own apps on the iPhone. Is this something to do with how it uses the browser?

It seems to work fine using the Appery Tester (web page).

The behaviour is;

This javascript is on the first app page and is a blank page. On Load the code runs, it navigates to the correct page but then immediately navigates back to the blank start page (with this code on).

There is nothing on the other pages in regard to navigation.

Michael Luce
Posts: 0
Joined: Mon May 11, 2015 5:58 pm

localStorage persistance when app is closed?

This doesn't work with the appery portal app (iOS). I have explained below.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

localStorage persistance when app is closed?

Michael,

Let's continue in one topic, if you don't mind:
https://getsatisfaction.com/apperyio/...

Return to “Issues”