However to get it to run optimally there's some issues I ran into and I haven't seen a topic about those yet.
We know you can play a HTML5 game on your iPhone in its browser, but I wanted to make it full screen, just as if it's an app you could find in the app store. Here's how!
Make a game / anything with a resolution of 320 x 480
Make sure it is controlled by mouse / tilt / not keyboard
Create the application
Next we need to edit the index.html file, open it in a text editor.
We will change this line:
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
This will make the iPhone's top status bar half transparent so we can see all of the game.
By default, the game will not fill the screen exactly, because there is a small margin around the canvas element.
We can change this by adding the following code somewhere between the <head> tags in the html:
Next put the canvas element between <div> tags, like so:
And finally right beneath that:
<div><canvas id="canvas" width="320" height="480">
<p>Your browser doesn't support HTML5 canvas.</p>
This will make sure the game fits the screen exactly. (There's probably some other ways to do this as well).
//get div to gain access to window size
//set canvas size to the whole window
Put your files somewhere online.
Navigate to the URL on your iPhone.
Use the option "Add to home screen" in your iPhone's browser.
Done! You can start the app from your iPhone's home screen and in full screen!
Tip: You can also create an icon for your app, as described here (step 3).
Hope this is helpful. I just figured this out and haven't really actually tested many ideas with it but if I do I'll post a link.
Edited by 2Dcube, 30 September 2011 - 02:57 PM.