Page 1 of 1

Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Wed Nov 27, 2013 6:57 am
by Hemant Soni

Hi

I have created an app project named Boston-Running-Center through my account.

there on the load event of start screen I have written below script so that in case any user has closed his app without logging out he/she need not to relogin to app at the time of reopening the app.

Detail of app are as below:

Accunt Email: a href="mailto:ymathur.yogesh@gmail.com" rel="nofollow"ymathur.yogesh@gmail.com/a
App NAME: Boston-Running-Center

if(localStorage.getItem('current_userToken') != "" && localStorage.getItem('current_userToken') != null) {
Appery.navigateTo('Menu');
}
else{
Appery.navigateTo('loginPage');
}

The problem is that the function appery.navigateTo() function is redirecting properly and the content of the next page is also reflects once for just 1 second, After that is shows back the content of the start screen without changing the url of the browser.

This problem is occurring while testing in Chrome and apple mobile.

I have created one more app with same code through another account and the same problem is occurring there too.

Detail of this app are as below:

Accunt Email: a href="mailto:oarevalo@gmail.com" rel="nofollow"oarevalo@gmail.com/a
App NAME: mitusis new

please provide some solution to this ASAP.

Thanks in advance


Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Wed Nov 27, 2013 7:05 am
by maxkatz

Please check the logic if your app -- to make sure you are not running any scripts that redirect back to the start page. Instead of using Appery.navigateTo(..) function, you can try switching to using Navigate to Page action -- just to compare the two approaches.


Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Wed Nov 27, 2013 8:44 am
by Hemant Soni

Hi the same code is working properly on android platform and Mozilla firefox. So it's not like any other script is redirecting back to the start page.

and also I need to change the redirection target page based on a condition, so in can't switch to Page action.


Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Wed Nov 27, 2013 7:22 pm
by Maryna Brodina

Hello! Use page Show event instead Load.


Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Thu Nov 28, 2013 6:19 am
by Hemant Soni

Hello i used the page Show event.

It's is still showing content of the start page after loading the page name passed in Appery.nevigateTo('pageName') function.

Although after this it finally shows the contents for the target page again.

But ideally it should not show the contents of the start screen if once redirects to the target page.


Content display problem in redirect through custom JS Appery.navigateTo('loginPage');

Posted: Thu Nov 28, 2013 7:39 pm
by Maryna Brodina

Hello!
1) Please note that DB access token might expire. That's why on start page you have to check not just token presence in localStorage, but also check if it's active. See here how to check it https://getsatisfaction.com/apperyio/...
2) "not show the contents of the start screen if once redirects to the target page" - not sure if it's possible. It's better to change content of start page to make it clear there is some validation (image/spinner)