Newbie wants to convert a simple website into an iPhone app, am I doomed?
March 10, 2008 6:54 AM   Subscribe

Easy way to turn my medical calculations website into an iPhone app? I tried fooling around with Xcode...

I have no formal programming experience, but I've picked up HTML, Javascript, CSS, and basic PHP/MySQL. I was reading about the iPhone SDK, and how it'll be "as easy to create an app as it is in Cocoa," so I gave Xcode a try this weekend, complete with beginner tutorials, but it was waaaay over my head. I have no experience at all in C or C++ or anything like that.

Basically what I'd like to do would be to copy all the HTML and javascript files from my website into a big folder and install it on an iPhone, using Safari to run the program. (Many hospitals don't have wireless access, and often have poor cell reception from all the thick walls and lead sitting around, hence wanting to allow people to run it locally.)

Is there a way to just call Safari and say, "open this index HTML file" in Cocoa/Xcode/the iPhone SDK? I'm afraid I don't have the time to pick up C or Object-C, even though I'd like to.
posted by gramcracker to Computers & Internet (7 answers total) 5 users marked this as a favorite
 
You couldn't just run it "in Safari" if you're relying on PHP+MySQL. That's stuff that has to happen at the server.

Technically it's possible to run a local server and point your browser at http://localhost , but for the iPhone, getting Apache to run as a background app apparently will violate Apple's conditions for 3rd party apps (I'd love to be proven wrong on that point).
posted by adamrice at 7:08 AM on March 10, 2008


Response by poster: Oh, no, I'm not using PHP/MySQL--I was just explaining the extent of my programming abilities. The site would only be static HTML, Javascript, and CSS.
posted by gramcracker at 7:16 AM on March 10, 2008


Ideally, it would be nice to just copy some html/css/image files to the device and view them through Safari, as you said. Someone at an Apple store told me you could NOT do this, nor could you just cache a site locally for viewing later. This seriously bummed me out, and is a big part of the reason I don't own the non-phone version of this device now. All this was pre-SDK, though.

Which is my way of saying a) the obvious may not work, and b) I'm really interested in the answers here.
posted by amtho at 7:33 AM on March 10, 2008


This is kind of possible using a mega-bookmarklet. Basically you embed the entire website (html and javascript) into a bookmarklet, which can then be run from Safari. I'm not sure exactly how it's done, but 1Password for example lets me save a full little site that lets me browse through all my encrypted notes and stuff.

Here's an example that adds a "View Source" bookmarklet to Safari on the iPhone. It appears it just generates the HTML with Javascript and injects it into the DOM.
posted by AaRdVarK at 7:39 AM on March 10, 2008


You could copy the files to their own /iphone directory and change the formatting to suit. Then just have a link to "IPhone version" on the front page (or wherever) that will bring up that version of the site and be able to be bookmarked. Alternatively you could serve out different CSS based on the User Agent, but that would be a more technical project than you may want to undertake.
posted by rhizome at 10:44 AM on March 10, 2008


rhizome - you've tried this? It lets you view the pages even when the iPhone can't connect to the net?
posted by amtho at 12:42 PM on March 10, 2008


The inability to read HTML off the iPhone's file system is a bit of a deal-breaker, for me. Quite disappointing.

There must be a way to create a Cocoa app which does nothing but display HTML though, right? It can't be that hard. But the Javascript might be a different matter.
posted by AmbroseChapel at 3:26 PM on March 10, 2008


« Older Life in the shoes of a business analyst   |   cell phone, cellular, mobile, phone Newer »
This thread is closed to new comments.