Source: http://adamlu.com /? P = 344
The three main technologies used to write iPhone web apps are HTML, CSS, and Javascript. They do not need to be installed on the iPhone or written in objective-C, therefore, it is relatively easy to get started with the front-end. Compared with native apps, Web apps have a fast development cycle and can run in any web browser, not just on Mac OS, the disadvantage is that you cannot access some hardware features of the iPhone and it is difficult to achieve some advanced UI effects.
There are some notes:
1. Prepare an iPhone style sheet
<LINK rel = "stylesheet" type = "text/CSS" href?”iphone.css "Media =" only screen and (max-width: 480px) "/>
2. Control page scaling. If this parameter is not specified, the iPhone determines that the webpage width is 950px.
<Meta name = "viewport" content = "user-scalable = No, width = device-width"/>
3. Add the Home Page icon. If you want to add a shortcut from your web app to the home page, you need to specify an icon. There are two options:
<LINK rel = "apple-touch-icon" href?”mycustomicon.png "/>
<LINK rel = "apple-touch-icon-precomposed" href?”mycustomicon.png "/>
4. Full Screen mode
<Meta name = "apple-mobile-web-app-capable" content = "yes"/>
5. Status Bar
<Meta name = "apple-mobile-web-app-status-bar-style" content = "black"/>
6. Customize the startup image. The size of this PNG image is 320px x 460px.
<LINK rel = "apple-touch-startup-image" href?”mstartupgraphic.png "/>
7. Use jqtouch for animation
Jqtouch is a jquery-based mobile Web development plug-in,: http://jqtouch.com/
8. Use HTML5 to store client data
HTML5 provides localstorage, sessionstorage and client database
9. Use HTML5 to implement offline applications
Offline applications need to store a manifest file on the server, and then <HTML manifest = "demo. manifest ">, if you are using Apache or other Web servers, you need to add. the htaccess file is in the directory of your website. The content in the file is addtype text/cache-manifest. manifest
The file format of manifest is as follows:
Cache manifest
Index.html
Scripts/demo. js
Styles/screen.css
Network: ----> fallback:
Logo.jpg ----> logo.jpg offline.jpg
Network indicates the online file whitelist. If you are offline, this image will not be displayed. If you want to replace this image with other images, you can change it to an arrow.
10. UsePhonegapTurn your web app into a native app
Phonegap is an open-source development tool that connects web applications and mobile devices.
For more information, see the book "Building iPhone apps with HTML, CSS, and JavaScript" and cloud Qian's "Web Front-end development on iPhone ".