App Cache and History API

Hi Everyone,

Whilst developing our latest app (https://github.com/PaulKinlan/ioreader)
for a recent conference, we ran into several large is limitations with
AppCache and HTML5 History that I wanted to share (and hopeful solve).
 Putting the current discussion of AppCache aside for a couple of minutes,
there is no provision in HTML5 History to include pages "pushStated" into
the current App cache group

Consider this flow.  We have a multi paged app with pages A and B when
rendered from the server sharing the same AppCache and thus in the same
group.

   - User visits page A, it uses an app cache, so everything is cached.
   - User navigates from A to B, page B is added to the app cache group.
   - User goes offline
   - User refreshes A it is served from the Cache,  User refreshes B, it is
   served from the Cache.

Update the AppCache, A and B are re-downloaded and cached [see: Death by App
Cache].

Now if we inject HTML5 History for the same flow:

   - User visits page A, it uses an app cache, so everything is cached.
   - User navigates from A to B (via pushState) .....  currently B is not
   added to the App Cache group.
   - User goes offline
   - User refreshes A it is served from the Cache,  User refreshes B, fail,
   because not in Cache.

I believe that as URL's change if the master page is app cached, those pages
should be added to the App Cache group.  You are still in the same
application, the state is just dynamically changed but in essence you are on
a page that should be available offline.  The act of changing the URL
client-side normally enforces you to generate the correct content on the
server if the page was simple fetched.

Death by App Cache: The problem that we also faced was as master entries are
added to an App Cache group, when an update to the App Cache occurs, all
those pages in the App Cache are refreshed, with more dynamic applications
this could mean that 10's or 100's of pages are quickly downloaded by the
App Cache software and thus can quickly cause a mini DDOS.

I am interested to hear your thoughts.

P
-- 
Paul Kinlan
Developer Advocate @ Google for Chrome and HTML5
t: +447730517944
tw: @Paul_Kinlan
LinkedIn: http://uk.linkedin.com/in/paulkinlan
Blog: http://paul.kinlan.me
Skype: paul.kinlan

Received on Tuesday, 17 May 2011 18:29:23 UTC