Created
October 18, 2012 07:01
-
-
Save cjanis/3910234 to your computer and use it in GitHub Desktop.
Resume iOS Web App on last open web page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you!!!!