views:

568

answers:

3

hey all,

We're developing an html5 offline webapp for the ipod touch/iphone. We have the manifests and everything working correctly, but we can't figure out why our app will not reopen after the 'tab' in iphone safari is closed.

For example's sake, here's what works:

1) open the url to the offline-enabled html file in safari on the ipod touch

2) exit safari, turn wifi off

3) go back into safari where the dynamic webapp is in a window, hit refresh

4) app works offline!

however, if we do this, the offline app dissapears:

5) add a bookmark to the app's url (or a home screen icon)

6) close the 'tab' or window in safari

7) open the bookmark or the home screen icon

8) error message: "Cannot Open Page: Safari cannot open page because it is not connected to the internet."

I've googled on the issue a bit, and you know how it goes, I'll find the answer 2 seconds after hitting 'post' here.. but anyway my gut feeling is that the current latest iphone OS version of safari is trying to dns lookup on the url and erroring out rather than realizing it has the locally stored app already on the device.

anyone run into this? is there some flag i can set in my manifest or something to fix this?

A: 

I'm also seeing this issue as I'm developing an offline app. Any tips?

+1  A: 

You probably do not have your server properly configured. The Apple docs do not make this clear.

If your server is running Apache (most likely), you need to edit this file:
/user/local/apache2/conf/mime.types

Add this line to the end:
text/cache-manifest manifest

You will need to restart Apache so the settings take effect. Could be something like
restart_apache from the shell.

What's happening here is that the server needs to return the cache file back to you with the proper content type set. If you don't do this, the file will probably come back as 'text'. If set properly, it will come back with a type of 'cache-manifest'.

To test what mime type a document is being returned as, use web-sniffer.net. Enter the url to your manifest file - you will see the result displayed in Content-Type:

ghenne