Skip to content

Web Publication JS Behaviour

Hadrien Gardeur edited this page Oct 7, 2016 · 2 revisions

The current version of Web Publication JS (https://hadriengardeur.github.io/webpub-manifest/examples/MobyDick/webpub.js) does the following things:

  • first, it checks if the browser has support for Service Workers
  • it looks for a link in the current document (from which Web Publication JS was called) that matches a Web Publication Manifest (rel="manifest" and type="application/webpub+json")
  • if such a link is available, it extracts the location of the manifest (href) and looks for the manifest in the cache (the cache name of each publication is the URI of its manifest)
    • if the manifest is stored in the cache, it displays a message in the console ("Found cache key") and does nothing more
    • if the manifest is not stored in the cache, it extracts all the locations to resources listed in the spine (reading order of the publication) and in resources (additional resources required to render the document) and stores them in the cache
Clone this wiki locally