views:

459

answers:

4

How do I go about allowing my webapp to be installed as an icon on a user's homescreen? Is the data cached locally, so that the webapp can be run when the user is outside of 3G?

I did a quick google, but my search terms were lacking. I noticed that Google Buzz allowed me to install locally, and I'm wondering what the process is for creating web apps, and if they get special treatment (full caching/running offline).

+3  A: 

This behaviour is done with a meta tag titled apple-mobile-web-app-capable.

Details (and other meta tags useful for iPhone web apps): http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

<meta name="apple-mobile-web-app-capable" content="yes">

To set a nice icon for your app, you can specify a URL for your icon:

http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html

<link rel="apple-touch-icon" href="/custom_icon.png" />

and a startup screen:

<link rel="apple-touch-startup-image" href="/startup.png" />

Data can be locally cached. You can store data using the various HTML5 JavaScript APIs and cache manifest.

ceejayoz
So is all the CSS/JS cached, so that it can be run locally when offline?
Stefan Kendall
You can set it up. See edit.
ceejayoz
+3  A: 

Here's another example of what you are trying to do, may be helpful: http://mrgan.tumblr.com/post/257187093/pie-guy

Eric Schweichler
I got down voted for this?
Eric Schweichler
+1 for usefulness.
Stefan Kendall
+2  A: 

See ceejayoz's answer for the various iPhone-specific stuff (icon, fullscreen mode), but in order to store the entire app locally (and run offline), you'll need to look at what's called a "cache manifest". This file, linked to in the opening html tag on your page, lists every resource the app needs to store locally.

Additionally, in order to store user data, if need be, you'll need to look into the client-side database. I don't know as much about that, so I won't try to explain it. :P

Apple has a decent page here: http://developer.apple.com/safari/library/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007256-CH1-SW1

that talks about both the cache manifest and local database storage. This should help explain what you need to do in order to make your application run offline.

Arclite
A: 

Check out: http://building-iphone-apps.labs.oreilly.com/

It covers all of the above topics. Also, I think that likely everything you want is available through HTML 5. I found this to be a good read, look at the section on "Taking it Offline":

diveintohtml5.org

counterbeing