AJAX on the iPhone? (5)
I have seen reference to using Ajax as an 'sdk' for iPhone. AJAX on the iPhone? (read the response for a link to dev works)
(1) It seems that AJAX does not work at all on the iPhone. IS this true? If not, how can I modify the HttpRequest create function to accomodate the iPhone?
(2) If AJAX is indeed impossible on the iPhone, is there a way I can modify the function given so that it will fail gracefully on the iPhone, and other scripts on the page will still function?
(3) If this is not true, what do I need to do server side (and is this even possible?) do detect the iPhone, so that I can remove the AJAX code entirely when an iPhone requests the page?
What would also work quite nicely is the ability to use CSS to detect the iPhone as a display device, and act accordingly, similar to what you use with Opera Show. Of course, this wouldn't fix the AJAX issue, but it would be neat. ^_^
Thanks for answers. Several of my customers access the site regularly from the iPhone, and I want my pages to work as much as they possibly can, so I'm willing to modify my code for it, even though I don't have one to test on.
I recommend you open iTunes and view (and do the exercises of) the iPhone application development course from Stanford University on iTunes University.
Your PHP experience is not going to be that much help, but Objective C is a nice language and Cocoa a great framework.
You can of course run a web application on the iPhone, but unless the server runs locally (e.g. using Seaside on Smalltalk) you are going to have severe performance issues as the roundtrip time to the server is rather high on 3G.
There's no reason AJAX wouldn't work on the iPhone, many of Google's sites/facebook etc use it perfectly well.
Does your AJAX work in Safari/Mac? That's the closest approximation you'll get in a non-mobile environment.
where to start developing iphone / mobile applications in php?
You can develop web services for the iPhone/iOS in PHP, either for a online web app that runs under Safari, or for inside an online application's UIWebView (see PhoneGap for an example).