localStorage getting wiped

I have an app that displays a splashscreen when it starts, then it goes to the home page. I am setting a variable in localStorage that when set, stops the display of the splash screen when the home form loads.

For example:

  • Open app
  • display splash then home form
  • open another form
  • click back button on current form
  • open home form (no splash)

What I am finding is that the localStorage variable are all empty when returning to the home form for the 2nd time, so the splash ends up displaying because it is unset. I would think that once the home form is opened that the localStorage would be set and would not get wiped.

Here is my code
frmHome is set in the project as the start form

    frmHome.onshow=function(){
           
        //Verify that the DB exists
        VerifyDatabase(DB);

        if (localStorage.homePage != "frmHome"){
            frmSplash.show();
        }

}

frmSplash onshow method is:

frmSplash.onshow = function() {
    //Validate the existence of the local database
    //If not there, then create and populate with defaults

    localStorage.homePage = "frmHome";

    //Pause for 2 seconds
    T = setTimeout(nextAction, 2000);
}

function nextAction() {
  frmSplash.hide();
}