In our application, in case the user clicked a certain button, we need to go back two screens. We do this with the following code:
app.navigate("#:back");//to budget edit
Testing this code works well on Chrome. It also works well in our tests on iPhone. However in our tests on Android (Nexus 7) it fails and only the first app.navigate("#:back") is executed. Meaning our app fails to bring the user to the correct view. Do you have any idea what might be the cause and how can we handle it?
6 Answers, 1 is accepted
Thanks Petyo - indeed it seems to do the trick.
Can/Should we also use the browser history API in order to clean its cache? Our app is based on sessions and currently the history is accumulated all the time. Meaning if one user logs into the app and then logs out clicking the back button will bring views from her expired session, and it is wrong. So we are looking for a way to clean the history when ever a new session is starting. Should we use this API as well?
I am not sure to which history API part you refer to, but I am not aware of means to clear cache and/or remove entries from it. In general, you may use the beforeShow view event handler to detect expired logins and redirect the user accordingly.
The problem is seen on android device as we have a back button there.
When the user is using it she might switch between users - if she is using to exit the app using the back button it results with us seeing views from the previous users until we complete going back the entire history.
This is also relevant for a one user scenario - if he exit the app using the home button and later uses the back button, again he will go over all his previous sessions.
Basically, we were wondering if there is a way to clear the views history.
I am not aware of any means to clear the browser history. Did you try the suggestion I provided? the beforeshow filter may help in this case.
We are well familiar with using beforeShow however this could not assist in the described problem as the Android back button will still walk us thru older sessions (even if we see partial views because the beforeShow knows it's a different session).
We eventually handled it by using history.go(-(history.length - 1)) as the following link suggested:
(Remark: we actually found out we need to use history.length - 3 for it to work well in our case)