Open Cordova app at last page visited -
i have cordova app has various html pages can accessed. app opens homepage.
is there way reopen app last page visited?
maybe pass current page var, , open or if empty open index?
you can catch several events in cordova, example pause event. here example in vanillascript:
var _storagekey = "lastpage"; // cordova ready, load last page document.addeventlistener("deviceready", deviceready, false); function deviceready () { var lastpage = localstorage.getitem(_storagekey); if (lastpage && window.location.pathname != lastpage) { window.location.pathname = lastpage; } // store location when app paused/closed document.addeventlistener("pause", savecurrentpage, false); } // store navigation function savecurrentpage () { localstorage.setitem(_storagekey, window.location.pathname); });
Comments
Post a Comment