Book Image

iPhone JavaScript Cookbook

By : Arturo Fernandez Montoro
Book Image

iPhone JavaScript Cookbook

By: Arturo Fernandez Montoro

Overview of this book

<p>Undoubtedly, the iPhone is one of the most exciting mobile devices in the world. Its iOS is used in other Apple devices such as the iPad and iPod Touch. With this book you'll learn how to build and develop applications for these devices without applying Apple's burdensome and at times restrictive technologies. Just use your experience and knowledge combined with web front-end technologies like JavaScript to build quality web apps. Nobody will know you haven't used Objective-C and Cocoa.</p> <p>The <i>iPhone JavaScript Cookbook</i> offers a set of practical and clear recipes with a step-by-step approach for building your own iPhone applications applying only web technologies such as JavaScript and AJAX. Web developers won't need to learn a new programming language for building iOS applications with a native look and feel.</p> <p>The first part of the book introduces you to the world of iPhone applications. Understanding how it works is required for designing good user interfaces for this device. You will continue learning about how to apply multimedia features to your applications. Common features of web applications, such as AJAX and SQL, can also be applied to our iPhone applications. The third part of the book explains how to deal with specific features of iPhone such as the accelerometer. At the end, you learn how to offer additional features through external websites. With the <i>iPhone JavaScript Cookbook</i>, you will be able to develop outstanding web applications with a for Apple's mobile devices, offering your users all of the advantages of the native look and feel.</p>
Table of Contents (17 chapters)
iPhone JavaScript Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing the WebApp.Net framework


This JavaScript framework is not specific for iPhone and other Apple devices. It was designed for different modern mobile devices focused on AJAX functionality, offering functions to avoid the complexity of developing this technology from scratch. In fact, it is very useful due to differences between web browsers of the mobile platforms and operating systems. This recipe explains how to install the WebApp.Net on Linux, Windows, and Mac OS X operating systems.

Getting ready

WebApp.Net is a set of HTML, JavaScript, and CSS files packed and distributed as a ZIP file and can be downloaded for free. We'll need a web browser to download this file and a tool to decompress it.

How to do it...

Type the following URL on your favorite web browser and click on the link located on the right (get it now: v0.5.2): http://webapp-net.com/.

When the file has been downloaded, it can be decompressed using a tool such as WinZip on Windows. Safari users will find a new folder called base-package-v0 on the default folder for downloads. Linux users can execute the following command from a terminal tool:

$ unzip base-package-v0.5.2-20100206.zip

After decompressing, you will need to copy the required files of the framework to our folder under control of the web server. For instance, you will execute these commands on Mac:

$ mkdir /Library/WebServer/Documents/WebAppNet
$ cp -r base-package-v0/WebApp /Library/WebServer/Documents/WebAppNet

How it works...

The main ZIP file of the framework contains many files but the most important is the WebApp folder that will be needed for developing our own web applications for the Apple devices. In order to use the WebApp.Net framework, at a minimum we will need two files that should be included on the head section of our HTML pages. Actually, the following lines are required:

<link rel="stylesheet" href="/WebAppNet/Design/Render.css" />
<script type="text/javascript" src="/WebAppNet/Action/Logic.js"></script>

Inside the WebApp folder, we can find different subfolders such as Design, Action, and Img. The first one of them stores two CSS files and some graphic images required by these stylesheets. Action subfolders contain the main JavaScript file called Logic.js and the last subfolder is Img, responsible for the main graphic files needed to get a native look and feel for the applications.

There's more...

As a part of the commented WebApp main folder, this framework contains other folders inside the ZIP file. These subfolders are Debug and Tools. The first one offers the JavaScript and CSS files without minimizing them, which is useful for development environments. They are more human readable than the others included on the WebApp main folder. The Tools subfolder has one PHP file for allowing us to use a proxy with the XML data. In addition, two stylesheets are also included. One of them is specific for the Mozilla Firefox web browser and can be used for testing and developing our web applications.

Note

WebApp.Net has a complete documentation for users and developers that can be found at: http://webapp-net.com/Doc/.

Same case as iWebKit, you can find a complete and useful forum for WebApp.Net at: http://webapp-net.com/Forums/.