0
Under review

Epubreader save bookmark does not work on iOS

Anne 7 months ago updated 6 months ago 2

Any browser running on an iOS device won’t update the bookmark/progress feature with the epubreader. I tested on iPad Mini 6, iPad Pro 2nd gen, and MacBook air. It seems to work fine on my Windows computers and Android phone. I think I traced it back to the event window.onbeforeunload in the epubreader.js. Researching it brings up that a number of browsers/systems don’t support/aren’t compatible with that event. I tested adding these:


document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'hidden') {
$scope.storeBookmark();
}
});

setInterval($scope.storeBookmark, 60000); // Save every 60 seconds


and it is now updating reading progress on epubs in the browser reader.
Hopefully this is helpful. Let me know if you need any help narrowing it down further or testing.

Under review

Thanks a lot for the thorough analysis !

I'd prefer to find a way to save bookmark when the page is closed rather than using a timer. So I'll probably try to use pagehide and visibilitychange events in addition or instead of beforeunload.

I don't have any iOS device though, I'll need some help testing the workaround when it's developped. :)

Right, I do recall thinking the timer wouldn't be great, but I tested a few different things at the moment and just pasted it all. I think the visibilitychange has been the most effective anyways.