Navigation History persistence needed for iOS web app

2 posts, 0 answers
  1. Ty
    Ty avatar
    2 posts
    Member since:
    Dec 2010

    Posted 09 May 2014 Link to this post

    As you may be aware, when you add a web page to the home screen of an iOS device it creates a "web clip".  When launched from this icon on the home screen, the site is loaded in Safari in "web app mode".  There are several advantages to this such as going full screen and feeling more like an app and less like a web page.

    However, there is a major downside to this.  When you switch to another app on your iPhone then switch back to this "web app", the state of the app is completely lost.  According to several sources on the web, this is by design.  The reasoning by Apple is that they need to be shut down your app to keep resources manageable.  It is the responsibility of the app developer to save state and restore state when the app is reopened.  

    OK.  I can accept that and I am almost there.  I am tracking the user's logged in security token, so they don't need to login again.  I also store the current hash so I if I detect that they are launching from with no referrer, I can send them to the same hash they were viewing when they left.  

    All is good.... EXCEPT back buttons don't work.  If the user was on a mobile view that had a back button, when the user multi-tasked away from it, then I will, of course, take them back to that page.  However, because there is no history, the Kendo UI mobile back button doesn't know what to do.

    So... how can I save off the current navigation history to localStorage and how can I restore it when relaunching the app?

    I see that app.pane.history has been deprecated.  This use case of an iOS web app launched from home screen seems pretty mainstream, so what is your current solution to this situation now that app.pane.history has been deprecated.

  2. Petyo
    Petyo avatar
    2444 posts

    Posted 10 May 2014 Link to this post

    Hello Ty,

    app.pane.history is not deprecated; it was a private field, which has never been a documented feature. Modifying internal and undocumented members of the Kendo UI framework is not supported. 

    Apart from that, the behavior you describe (iOS resetting the app state) is not specific to web clips. This document describes the iOS apps state transitions in details. 

    If your only concern is the back button not working, you may hard-code a href attribute (and a reverse transition) for it. This his how our online mobile examples work, so that we may support deep linking to a specific example. 

    Saving and restoring the app history is not possible - the mobile application (and Kendo UI routing) relies on the browser history object navigation/events. The browser history can't be read or modified, due to security restrictions. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top