Take your drupal sites offline

Preview:

DESCRIPTION

Take your Drupal sites offline with HTML 5 AppCache and turn it into a webapp, perhaps with somehting like PhoneGap.

Citation preview

TAKE YOUR DRUPAL SITES OFFLINEWith HTML5 AppCache and other assorted teasing promises…

AppCache

• Take a Website offline• Speed up access• Create ‘WebApps’• Perfect for mobile

How does it work?

<!DOCTYPE html><html manifest="/cache.manifest"><body>

...

</body></html>

How does it work?

• (Maybe) In .htaccess or similar• Needs to be running on a server

AddType text/cache-manifest .appcache

How does it work?CACHE MANIFEST# 2013-03-12:v2

CACHE:index.htmlstylesheet.css

NETWORK:login.php/myapi

FALLBACK:images/large/ images/offline.jpg*.html /offline.html

SIMPLE DEMO

What about Drupal?

• More complex• Dynamic

drupal.org/project/appcache

With some module changes…

How does it work?

Adds variable that is reset on cache clear, amends manifest and causes browser rebuild.

Builds cached pages as it goes.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" manifest="<?php print base_path(); ?>appcache.manifest" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>

Pointers

• May not want to apply to whole site

• Authenticated areas• Offline files• Admin items• User confusion

Taking it mobile

• PhoneGap if AppStores

• WebApp in other cases

GOTCHAS…

Just some of them…

•Mobile / Browser detection•Cache size restrictions•PhoneGap•JavaScript issues•Local testing• Inconsistent•Media files

PLAN BA whole other story…

THANK YOU…Chris Ward

chris@moatmedia.com.au

@chrischinch

Recommended