Return to document without reloading HTML

I've built a Hype document with multiple scenes that runs inside an application called iPresent.

The document contains links to external websites. When the user returns to the Hype document after clicking on one of those links, the Hype document reloads and the initial screen is presented.

I'd like to alter that behavior, so that the user returns to the Hype document at the scene they last visited.

--

Here's what I tried, based on previous posts to this incredibly helpful forum, which for some reason didn't work. Wondering if I'm missing something simple.

On the home scene, called "Home":

p1943

  if (localStorage.scene) { // if there is a variable stored (returns true)

    hypeDocument.showSceneNamed(localStorage.scene, hypeDocument.kSceneTransitionInstant)

} else { // if there is nothing stored you can do something here.
    
}

On a screen with external links:

p1944

   localStorage.scene = hypeDocument.currentSceneName();

On the close button for a screen with external links, to reset the counter:

p1945

   localStorage.clear();
hypeDocument.showSceneNamed('Home', hypeDocument.kSceneTransitionCrossfade, 1.1)

Any suggestions? Thanks in advance.

The code fundamentally looks fine from this glance; there may be an issue in your logic on when you choose to store/clear that blows away the data you need. You're welcome to share a zip of the document or a small sample that demonstrates the problem.

(I'd also make sure to examine the javascript console just to be sure there isn't some syntax error getting in the way of it working)

Thanks so much, Jonathan! Got it to work!

Now, onto the next puzzle ...

:slight_smile:

1 Like