Problem with consecutive calls to app.navigate("#:back")

7 posts, 0 answers
  1. Ron
    Ron avatar
    122 posts
    Member since:
    Sep 2011

    Posted 18 May 2015 Link to this post

    Hello,
    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");
                        setTimeout(function(){
                            app.navigate("#:back");//to budget edit
                        }, 0);
                    }
    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?

    Thanks,

    Ron.

  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 20 May 2015 Link to this post

    Hi Ron,

    you can use the native browser history API - like history.go(-2);

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Ron
    Ron avatar
    122 posts
    Member since:
    Sep 2011

    Posted 26 May 2015 in reply to Petyo Link to this post

    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?

    Ron.

  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 28 May 2015 Link to this post

    Hello,

    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. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Ron
    Ron avatar
    122 posts
    Member since:
    Sep 2011

    Posted 28 May 2015 in reply to Petyo Link to this post

    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.

  7. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 01 Jun 2015 Link to this post

    Hello,

    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. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Ron
    Ron avatar
    122 posts
    Member since:
    Sep 2011

    Posted 02 Jun 2015 Link to this post

    Hi Petyo,

    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:
    http://stackoverflow.com/questions/14920806/is-it-possible-to-onclick-history-clear

    (Remark: we actually found out we need to use history.length - 3 for it to work well in our case)

Back to Top
Kendo UI is VS 2017 Ready