foliate-js
foliate-js copied to clipboard
Store and retrieve document location to resume document reading
Hi @johnfactotum
First of all, thank you for this library, it's really awesome :)
I'm trying to store the current page of a document to the browser's local storage, so the user can resume reading where he or she left off. My idea was to update the values in the local storage every time the onRelocate
event is triggered, as seen in the reader.js
example reader, and then retrieve this value when loading again the document.
Going through the documentation, there is .goTo({ index, anchor })
method in the renderer, but I don't know the format of the attributes it requires, even after looking to the resolveHref()
mentioned.
How can I achieve this?