Reload Hype Document when using the back button in Safari

If you return to a Tumult Hype document by using the back button in Safari, your document will sometimes remain in the condition you left it: it will likely be on the same scene and timeline state. Want to avoid this?

Add the following to the ‘head’ of your document. You can edit the contents of the <head>…</head> of your exported .html file by clicking on ‘Edit HTML Head’ in the Document Inspector.

<script type="text/javascript">
window.onpageshow = function(event) {
    if (event.persisted) {
        window.location.reload();
        // or: 
        HYPE.documents['documentName'].showSceneNamed('Scene 1',HYPE.documents['documentName'].kSceneTransitionInstant); 
    }
};
</script>

More info here: http://stackoverflow.com/questions/8788802/prevent-safari-loading-from-cache-when-back-button-is-clicked

3 Likes