16
How to build a offline webapp for the iPhone ... By Bert Timmermans

iPhone offline webapps

  • View
    63.875

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: iPhone offline webapps

How to build a offline webapp for the iPhone ...By Bert Timmermans

Page 2: iPhone offline webapps

Bert TimmermansStudent Communicatie Multimedia & DesignFreelance - Nocus Communication - Hasselt

Web design / web developmentiPhone web development projects:

• Keypoint Beta 3• Checklist• ...

Mail: [email protected]: @berttimmermans Website: http://www.berttimmermans.com

Page 3: iPhone offline webapps

✤ Main introduction

✤ Step 1 The interface

✤ Step 2 The database

✤ Step 3 Making it available offline

Overview

Page 4: iPhone offline webapps

✤ Mobile Safari

✤ Html 5 & Javascript

✤ Local database

✤ Caching the webapp for offline use

Introduction

Page 5: iPhone offline webapps

Example

Checklistberttimmermans.com/checklist

Page 6: iPhone offline webapps

✤ Mobile interface

✤ iPhone optimization

✤ iPhone codes

Step 1 The interface

<!-- iPhone codes --><link rel="apple-touch-icon" href="image/icon.png"/><meta name="viewport" content="width=device-width; initial-scale=1.0;" />

<meta name="apple-mobile-web-app-capable" content="yes" /> <meta names="apple-mobile-web-app-status-bar-style" content="black" />

Page 7: iPhone offline webapps

Step 1 The interface

#object {position:absolute;left: 0px;-webkit-transition-property: left;-webkit-transition-duration: 0.5s, 0.5s;}

#object.class {left: 10px;

}

✤ CSS 3 (-webkit-) support

Example

Page 8: iPhone offline webapps

Step 1 The interface✤ Javascript solutions

✤ jQuery, mootools, ...

✤ Fixed header

✤ Rotation detection

✤ Location detection using free appstore app

✤ ...

Page 9: iPhone offline webapps

Step 2 The database✤ Clientside Javascript database

✤ Safari and other webkit based browsers like Google Chrome

✤ An option to sync with a online database

✤ MYSQL commands

✤ User can manage database using preferences

Page 10: iPhone offline webapps

Step 2 The databaseExample code

var db;

try { if (window.openDatabase) { db = openDatabase("Checklist", "1.0", "HTML5 Database API", 200000); if (!db) { alert("Failed to open the database"); } else{ var highestId = 0;

} } else alert("Couldn't open the database. Please try with a WebKit");}

Page 11: iPhone offline webapps

✤ Firefox en iPhone safari

✤ HTML 5 manifest file

✤ Example of a manifest file

Step 3 Caching the webapp

CACHE MANIFEST

css/main.cssimages/main.pngjs/database.js

<html manifest="main.manifest">

Page 12: iPhone offline webapps

✤ IMPORTANT !

The manifest file has to have a text/cache-manifest MIME type

Solution a .htacces

Step 3 Caching the webapp

AddType text/cache-manifest .manifest

Page 13: iPhone offline webapps

One more thing ...tinyurl.com/1morething

Page 14: iPhone offline webapps

TweetwallYour mobile twitter wallberttimmermans.com/tweetwall

Page 15: iPhone offline webapps

The end

Page 16: iPhone offline webapps

Barcamp Antwerp 2009 was sponserd by