Guys -
I posted a link to a HTML5/CSS/JavaScript AJAXish WebApp that demonstrates several of the topics that are being discussed here. Since there may be some confusion I hope to clarify things in this new thread.
1. The link that we are discussing is:
http://wisen.us/pricecalcwhich
is a little toy that I did a while back, when I first waded through all
these issues. I posted the link since it is a working example and can be examined with the "View Page Source" feature of your browsers.
2. If you hit the page with an iPhone/iPad you get the App. If you use anything else it turns itself into a promo page using XMLHttpRequest(). This is because it wouldn't work at all on a non-WebKit browser. You can use desktop Safari if you tell it the User Agent is a Mobile Safari version.
3. There are several numeric entry fields that are completely fabricated in JavaScript. The keyboard is synthesized instead of trying to use a native iOS entry technique. There is a blinking cursor in the active entry field.
4. Data is pulled from a server to do the Currency Conversion Rate feature. This also uses XMLHttpRequest().
5. The manifest is disabled on this page, so it will not work in Airplane Mode.
6. The Google banner ad shows how one
would implement an old-style ad-supported page. I have not done a version that uses iAd.
7. The $0.99 app in the App Store is almost exactly the same thing you see here, but using Lee Barney's very nice QuickConnect as a wrapper. It DOES work in Airplane mode, and (of course) has the banner eliminated.
8. The values of all the user selections, conversions and entry fields are saved in localStorage so that you can leave the App and return to right where you left off. This feature is worth examining, because of how I handle the sneaky length limitation and random evaporation of localStorage. In a nutshell, I add a Magic value to the end of the string which I use as a sanity check for any persistent data.
9. None of this code is in any way intentionally obfuscated, so I hope any interested parties (and lurkers) can benefit from poking into it.
I had not particularly intended to publish this, but lots of people
seem to be struggling with these common issues. It is not like this is intended to be a tutorial, but it is also fairly compact and implements a lot of useful features.
Brian