Skip to content

Instantly share code, notes, and snippets.

@cjanis
Created October 18, 2012 07:01
Show Gist options
  • Save cjanis/3910234 to your computer and use it in GitHub Desktop.
Save cjanis/3910234 to your computer and use it in GitHub Desktop.
Resume iOS Web App on last open web page
if (window.navigator.standalone) {
var setLastUrl = function() {
localStorage['lastUrl'] = window.location;
}
if (sessionStorage['init']) {
setLastUrl();
} else {
sessionStorage['init'] = true;
if (localStorage['lastUrl']) {
if (localStorage['lastUrl'] != window.location) {
document.location.href = localStorage['lastUrl'];
} else {
setLastUrl();
}
} else {
setLastUrl();
}
}
}
@bear30921
Copy link

thank you!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment