Safari Reference Library Apple Developer
Search

Introduction

Safari runs on multiple operating systems and devices. All versions of Safari—Safari on the desktop and Safari on iPhone OS—use the same WebKit engine. Therefore, web content intended for the desktop might work well on devices running iPhone OS without any modifications. Some differences exist, however, so at a minimum you should ensure that your webpages are compatible with Safari on iPhone OS. Next, you might optimize your webpages for iPhone OS simply as a convenience to the user. For example, ensure that your webpages work over Wi-Fi, 3G, and EDGE, scale correctly when rendered, and contain media that is viewable on iPhone OS. There are also a few modifications you can make for specific devices such as iPad. Finally, you might build custom web applications for either platform that look and behave like native applications.

Safari on the desktop is the Safari application that runs on Mac OS X and Windows. It is a full-featured web browser for the desktop that supports industry standards as well as many WebKit extensions. In addition, it includes a number of tools that developers can use to analyze, test, and debug websites and web applications.

Safari on iPhone OS, the application for browsing the web on devices such as iPhone, iPod touch, and iPad, is also a full web browser running on a small handheld device with a high-resolution screen. This unique implementation of Safari responds to a finger as the input device and supports gestures for zooming and panning. It also renders webpages in portrait or landscape orientation. It contains many built-in features such as PDF viewing, video playback, and support for links to the native Phone, Mail, Maps, and YouTube applications.

The WebKit is an open source project as well as a framework in Mac OS X that lets developers embed a web browser in their Cocoa applications. WebKit has a JavaScript and Objective-C interface to access the Document Object Model (DOM) of a webpage. Dashboard, Mail, and many other Mac OS X applications also use WebKit as an embedded browser. You can use the UIWebView class in UIKit on iPhone OS to embed a web browser in an native iPhone application.

In addition to providing browser functionality, WebKit also implements some extensions to HTML, CSS, and JavaScript, including several specific to Safari. Safari extensions include CSS animation and transform properties, and JavaScript database support. Safari on iPhone OS includes JavaScript multitouch event support. Some extensions are fully supported on both platforms and others are not. Check reference documents for specific availability of those features you want to use.

This document teaches you how to create web content compatible with Safari running on any platform and how to separate your iPhone OS-specific web content from your other web content so that when you optimize your web content for iPhone OS, it still works on the desktop and other browsers. This document also covers some basics on tailoring web applications for iPhone OS.

iPhone OS Note: Safari on iPhone OS behaves the same on different devices except when the user taps links to iPhone-only applications. Read Apple URL Scheme Reference for information on the links that behave differently on other devices. On iPad, the behavior of HTML5 media elements is similar to the desktop. Read Safari HTML5 Audio and Video Guide for the differences on iPad.

Who Should Read This Document

You should read this document if you want your web content to look good and perform well on either the desktop or iPhone OS, plan to write iPhone OS-specific web content, use iPhone OS-specific style sheets, or use iPhone application links in your web content. Definitely read this document if you are creating a custom web application for either platform.

iPhone OS Note: Also read iPhone Human Interface Guidelines for Web Applications, a companion document, which describes how Safari on iPhone OS behaves and contains metrics and tips on designing user interfaces for iPhone OS. Understanding how Safari on iPhone OS presents web content to the user and how the user can zoom, pan, and double-tap on your webpages are prerequisites for reading this document.

Organization of This Document

This chapter covers important information that you should read first:

This chapter covers the first steps you need to follow to optimize web content for Safari:

These chapters describe different ways to optimize web content for iPhone OS:

This chapter describes how to create video content for multiple platforms:

This chapter covers information on how to store data locally:

This chapter covers information on how to debug web content:

If you are new to web development, read these appendixes that provide introductions to HTML and CSS:

See Also

There are a variety of other resources for Safari web content developers in the ADC Reference Library.

If you are creating an iPhone OS web application, then you should also read:

If you want to learn more about visual effects, then you should read:

If you want to embed video and audio in your webpages read:

If you want to learn more about JavaScript multi-touch event support, then you should read:

If you want to learn more about JavaScript database support, then you should read:

If you want to use the JavaScript media APIs, then you should read:

If you want to learn more about what HyperText Markup Language (HTML) tags and Cascading Style Sheets (CSS) properties are supported in Safari, then read:

If you are using JavaScript and want access to the DOM or use the canvas object, then read:

If you are developing web content for Safari on the desktop and iPhone OS, then you should read:

If you want to embed a browser in your iPhone OS application, then read:

If you want to learn more about WebKit or contribute to the open source project, then go to The WebKit Open Source Project.

If you want to read the WebKit W3C proposals, then go to: http://www.webkit.org/specs.




Last updated: 2010-03-24

Did this document help you? Yes It's good, but... Not helpful...