Just wondering if anyone else has experienced this?.. after adding a Hype page as an iPhone home screen web app from my server, everything works fine until I close the web app (swiping up in the app switcher screen) and relaunch it - instead of starting on the first scene again, the app continues from the last scene I was viewing before closing.
I know there is a thread or two on here where people actually want this to happen but I need the opposite, the web app should always start from the beginning of the first scene every time it is opened.
I’ll work on getting a stripped down version that I can share here but if anyone has any ideas in the meantime, would be much appreciated!
One purpose of the “Home screen web app” checkbox is to try to preserve state. You could disable that and you are still able to use the iPhone to add the page to the home screen; it will just more appear as a regular web page with a titlebar.
If that isn’t acceptable, my guess would be that you could use the Page Visibility API to determine when the page is shown, and force a reload. The code would be added to your Head HTML and look something like:
Yep, I was just going to reply that that pretty much nailed it, thank you @jonathan! I’m just getting a very quick glimpse of the page before it reloads on open, almost unnoticeable but just having a tweak to see if I can solve it. Cheers!
Interesting, your test doesn’t reload on my phone either. iPhone 8, iOS 12.2. No worries though, I think I can work with the ‘visible’ version. Thanks for your time and help!
You might still be able to use the hidden state condition to do something like jump to a blank scene, so that when the user does come back they don't see the page as it was. Then still use the visible condition to do the reload.
Most likely the problem is that you don’t have a reference to the hypeDocument object. An easy way to get it may be to make a on scene load handler that you make sure only runs once; that will have the object. Secondarily to that, you’d definitely want an instant transition as the web view is going away and won’t even have .1 seconds to run.
Yet all of that said I couldn’t get it to work with those changes, so it might just be you don’t really get enough of an opportunity to run code on the hidden change.