Cache pages

44 views
Skip to first unread message

AJ

unread,
Sep 29, 2014, 1:04:17 PM9/29/14
to monoc...@googlegroups.com
Hi,

I have a book with each page as a chapter (each html file is 1 page long and 1 chapter).
I wondered if I can cache several pages/chapters?
At the moment monocle caches 1 page only, that makes it slow on mobile phones, 

(for example, if I have page 1 showing, only page 2's iframe is cached below it, I want more
pages to be cached below it and above it.)

I would like to cache 5 pages at a time.

Many thanks,

Joseph Pearson

unread,
Sep 29, 2014, 2:35:01 PM9/29/14
to monoc...@googlegroups.com
It depends what you consider "cached".

Trivially, you can pre-fetch your component HTML via AJAX and serve it from memory in your getComponent() call.

If you have secondary resources that are referenced by your HTML, these won't be fetched until your HTML is loaded into the iframe, which is really the more common cause of loading delays. Some people have got around this by splicing those resources into the HTML inline, using data URIs. Others have used applicationCache. Both roads are moderately challenging.

If you want to pre-populate iframes in the background, you're working very differently to the way Monocle works. Browsers tend to reload iframes when they are moved to another parent in the DOM, so you would need to have four or more pages underlying the top page. You could perhaps do it with a custom flipper, but it sounds rather like a rewrite.

In general, Monocle comes from a time when most mobile devices had puny amounts of memory. It's therefore designed as a streaming ebook reader — it conservatively fetches the content on-demand, rather than up-front.

— J

--
You received this message because you are subscribed to the Google Groups "Monocle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages