From 2d0e409ac4f48b73ae5555977f6cc21e91948df7 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Wed, 16 Dec 2015 09:50:58 +0100 Subject: [PATCH] Made content state beeing saved on safari@iPad when closing tab and leaving tab --- js/h5p.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 24d9846..cd31b84 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1948,7 +1948,7 @@ H5P.createTitle = function (rawTitle, maxLength) { if (H5PIntegration.saveFreq !== false) { // Store the current state of the H5P when leaving the page. - H5P.$window.on('beforeunload', function () { + var storeCurrentState = function () { for (var i = 0; i < H5P.instances.length; i++) { var instance = H5P.instances[i]; if (instance.getCurrentState instanceof Function || @@ -1960,7 +1960,9 @@ H5P.createTitle = function (rawTitle, maxLength) { } } } - }); + }; + H5P.$window.one('beforeunload unload', storeCurrentState); + H5P.$window.on('pagehide', storeCurrentState); } /**