Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

Introduction to Web Kit Objective-C Programming Guide

Note: This document was previously titled Displaying Web Content.

Important: Web Kit is available as an Objective-C API for Mac OS X version 10.3 and later. The HTML editing, JavaScript, and DOM APIs are available in Mac OS X version 10.3.9 and later.

Contents:

What Is the Web Kit?
Who Should Read This Document?
Organization of This Document
See Also


What Is the Web Kit?

The Web Kit provides a set of core classes to display web content in windows, and by default, implements features such as following links clicked by the user. The Web Kit greatly simplifies the complicated process of loading webpages—that is, asynchronously requesting web content from an HTTP server over the network where the response may arrive incrementally, in random order, or partially due to network errors. The Web Kit also simplifies the process of displaying content that can contain various MIME types, and multiple frames each with their own set of scrollbars.

You use the Web Kit to display web content in a window of your application. It’s as simple as creating a view, placing it in a window, and sending a URL load request message. By default, your Web Kit application behaves as you would expect without error. The Web Kit conveniently creates and manages all the views needed to handle different MIME types. When the user clicks on a link in a page, the Web Kit automatically creates the views needed to display the next page.

However, the Web Kit doesn’t implement a complete set of web browser features. You can, however, extend the Web Kit by implementing custom delegate, view, and model objects. For example, you can implement a delegate to display load status, and the current URL.

The Web Kit also offers web content editing. If you enable editing in your WebView, users can edit the web content it displays. You can programmatically control the current selection and control editing behavior using a WebView delegate. You can also modify the Document Object Model directly using an Objective-C API.

You can also access JavaScript from Objective-C and vice versa.

Who Should Read This Document?

The Web Kit Objective-C API is specifically designed for embedding web content in your Cocoa or Carbon applications—developing web client applications not web server applications or web content. It is also not suitable for implementing non-GUI applications such as web crawlers. If you are a web content creator or JavaScript programmer, refer to Web Kit DOM Programming Topics.

Important: Currently, this API is available in Objective-C only. A minimal C API is provided for embedding web browser views in Carbon applications. You can use Objective-C in combination with C. The Web Kit works with all versions of Mac OS X 10.2 that have Safari 1.0 installed.

Organization of This Document

The following articles cover key concepts in understanding how the Web Kit works:

The following articles explain how to display web content in views:

The following articles explain how to implement web content editing:

The following articles explain how to use the Document Object Model Objective-C API:

Read this article if you want to access JavaScript from your application:

You begin using the Web Kit by first embedding web content in your application. Read “Simple Browsing,” and, optionally, “Loading Pages” and “Loading Resources” to embed web content. If you want to add more browser-like features or implement a custom user interface, read “Core Web Kit Classes” first and any other articles based on your application needs. If you want to edit web content, read “Enabling Editing.”

See Also

For more details on the Objective-C Web Kit API, read:

There are other technologies, not covered in this topic, that can be used in conjunction with the Web Kit or separately to solve related problems.

Refer to this document for more details on the URL loading system:

If you are accessing the Web Kit from a Carbon application, refer to these documents:

If you are creating web content for Safari or Dashboard, refer to these documents:

The /Developer/WebKit/Examples folder also contains more in-depth code examples.

Other related text book resources are:

Also refer to the World Wide Web Consortium at www.w3.org for the latest information on web standards.



Next Page > Hide TOC


Last updated: 2006-05-23




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice