Important: This is a preliminary document. Although it has been reviewed for technical accuracy, it is not final. Apple is supplying this information to help you adopt the technologies and programming interfaces described herein. This information is subject to change, and software implemented according to this document should be vetted against final documentation. For information about updates to this and other developer documentation, you can check the ADC Reference Library Revision List. To receive notification of documentation updates, you can sign up for a free Apple Developer Connection Online membership and receive the bi-weekly ADC News e-mail newsletter. See http://developer.apple.com/products/for more details about ADC membership.)
JavaScript is a powerful interpreted scripting language designed for embedding into web-based applications. You can use the JavaScript Document Object Model (DOM) in Safari and the WebKit framework to help provide dynamic content to your users, whether you are designing web content, Dashboard widgets, or Cocoa applications.
This document is designed for a number of different audiences:
If you are a web content developer—developing web sites and embedded JavaScript applications—you should read about Safari’s JavaScript support and how scripts operate within WebKit-based applications.
If you are a Cocoa and WebKit developer, you should read about how to integrate JavaScript into your WebKit views and how to enhance your user experience in doing so.
If you are a Dashboard developer, you should read about integrating JavaScript into your widgets to provide a better user experience and more advanced features to your users.
The topic contains the following articles:
“About JavaScript and the DOM” describes the JavaScript language and its implementation in Safari and WebKit.
“Using the Document Object Model From JavaScript” discusses the Document Object Model and how to use it from JavaScript.
“Using the Canvas” describes the canvas object, a critical part of Dashboard but also useful within other WebKit applications.
“Using the Pasteboard From JavaScript” describes how to implement copy and paste functionality within embedded JavaScript applications.
“Using Drag and Drop From JavaScript” describes how to use Mac OS X drag and drop functionality from within Safari and WebKit windows.
“Using XMLHttpRequest Objects” describes how to request data from network resources using the XMLHttpRequest
object.
“Calling Objective-C Methods From JavaScript” describes how to use Objective-C in the JavaScript scripting environment, either within a WebKit object or by using a custom browser plug-in.
Safari HTML Reference provides descriptions of HTML tags, attributes, and other markup.
Safari CSS Reference provides descriptions of CSS properties and constants.
Safari Web Content Guide provides information about designing web content for iPhone.
Dashboard Programming Topics provides information on the technologies available to you when creating a Dashboard widget. Additional Dashboard documents and sample code can be found in the Reference Library > Apple Applications > Dashboard.
Apple JavaScript Coding Guidelines provides general tips about the JavaScript programming language.
The Reference Library > Apple Applications > Safari section of the ADC Reference Library provides useful information on WebKit, the technology that provides Apple’s JavaScript runtime.
Last updated: 2010-01-20