Book Image

iPhone JavaScript Cookbook

By : Arturo Fernandez Montoro
Book Image

iPhone JavaScript Cookbook

By: Arturo Fernandez Montoro

Overview of this book

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. The iPhone JavaScript Cookbook 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. 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 iPhone JavaScript Cookbook, 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.
Table of Contents (17 chapters)
iPhone JavaScript Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Sending an SMS to a number


The previous recipe explained how you can call a number from your applications. This recipe will show you how to send an SMS to a selected number. For simplicity we're going to use the same approach. We'll develop a simple XHTML file displaying a list with different contacts. When the user clicks on one of the contacts the iPhone will display the screen for sending an SMS.

Getting ready

As in the previous recipe we will use the iWebKit framework. As both recipes are similar, we're going to use the same XHTML file developed for the previous recipe.

How to do it...

  1. 1. Open the call.html file and replace the content of the href attribute of each<li> item for a new string starting with sms: instead of tel. For example, the first item will be the following:

    <li>
    <a class="noeffect" href="sms:555-666-777">
    <span class="name">Aaron Stone</span>
    </a>
    </li>
    
  2. 2. Save the new content of the original file as a new file called sms.html...