Jonathan Nakouzi
Posts: 0
Joined: Mon Mar 30, 2015 10:30 am

local storage variable decides which page to load

Hi. I've been struggling with this so I hope someone can help.

I have variable in local storage. I want to inspect its value and depending on that decide which page to go load. It must be a very common pattern, but I can't see how to do it.

e.g. user details. if undefined go to registration page otherwise go to other page

Any clues will be highly appreciated.

TIA
J

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

local storage variable decides which page to load

Hi Jonathan,

Sure, here is a code that you need to use on goal event:

pre

//Where "localStorageVariableName" is your local storage name.
var lsvValue = localStorage.getItem("localStorageVariableName");

//Navigate to "someStartPage" is lsv is "start"
if(lsvValue == "start"){
Apperyio.navigateTo("someStartPage");
};

//Navigate to "someEndPage" is lsv is "end"
if(lsvValue == "end"){
Apperyio.navigateTo("someEndPage");
}

...........

/pre

Regards.

Return to “Issues”