Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
About Web Browser Plug-ins
Web browser plug-ins are considered extensions to existing web browsers. By installing them locally on your machine, you can “teach” your web browsers to support alternative content types—perhaps even custom types you design yourself—or to perform additional tasks that a ready-made browser cannot do.
The WebKit framework natively supports the Netscape-style plug-in API, which is based off a common cross-platform API. This API is described futher in “Creating Plug-ins with the Netscape API.”
Installing Your Plug-in
Plug-ins can be stored in one of two places on an OS X system:
Plug-ins stored in
/Library/Internet Plug-inscan be shared by all users on the computer.
Plug-ins stored in
~/Library/Internet Plug-inswill be available only to the user whose home directory contains them.
In addition, the WebKit-based plug-ins can be stored inside the bundle of any application that uses the WebKit, by storing it in:
AppName is the actual application’s executable bundle.
Plug-ins are generally reloaded on each application start.
Deploying Your Plug-in
Content that your plug-ins will view needs to be embedded within HTML. Most browsers do this with an
EMBED tag, but others require the
OBJECT tag. For maximum compatibility, you can tune your page to support both. The example in Listing 1 is specific to the QuickTime plug-in provided by Apple, and you can tune these parameters to your own mode of business.
Listing 1 Embedding a movie into an HTML page
<PARAM name="SRC" VALUE="sample.mov">
<PARAM name="AUTOPLAY" VALUE="true">
<PARAM name="CONTROLLER" VALUE="false">
The variables for the Active X controls will change based on your plug-in’s behavior. Read Apple’s HTML Scripting Guide for QuickTime tutorial for more information.