check localstorage and redirect on page load

I wonder if I'm trying to do it wrong or if there is a better way to do it.

When my app load, I'd like to check for a localstorage variable (_sessionid) and base on its presence, load the dashboard or the login page of my app.

What would be the best way to accomplish this? At first, I put the javascript on the page show event of my login page and set "start page" to it. The problem is that there is a flickering going on between the two pages.

Is there a way to run some javascript before loading any page so I could set the start page programatically? or may be my start page should be another page that would just check for the localstorage and redirect to one of two other pages?

thanks for any advice on this.
1 person has
this question
This topic is no longer open for comments or replies.