ADC Home > Reference Library > Technical Notes > Apple Applications > Safari >

Browser Plugins in Mac OS X

CONTENTS

This document describes the unique features of browser plug-ins for Mac OS X. You should read this document if you are:

- writing a browser for Mac OS X
- porting a browser to Mac OS X
- writing a browser plug-in for Mac OS X
- porting a browser plug-in to Mac OS X

This document assumes that you already know how to create a Netscape-style browser plug-in, and how to create a CFM library for the Mac OS X.

 [May 31 2001]






Overview

Browser plug-ins for Mac OS X follow the same basic plug-in architecture for traditional Mac OS that was introduced by Netscape. A browser plug-in is implemented as a CFM (Code Fragment Manager) library; all calls between the browser and the plug-in assume CFM-calling conventions. All calls between the browser and plug-in are made using simple ProcPtrs instead of UPPs.

Back to top



Required changes from Earlier Versions of Mac OS

Browser plug-ins for Mac OS X are similar to browser plug-ins for Mac OS 7, 8 and 9 with the following differences:

  • Carbon plug-ins must link to CarbonLib instead of InterfaceLib, QuickTimeLib, et cetera.

  • All Carbon plug-ins must have a 'carb' resource with an ID of zero (this resource need not contain any data).

  • The main entry point of the plug-in should be a function "main" instead of a routine descriptor "mainRD" (There are no routine descriptors in Carbon on Mac OS X).

  • All calls between the plug-in and the browser use simple ProcPtrs rather than UPPs.

  • A Carbon plug-in's file type should be 'BRPL' instead of 'NSPL'. This change is designed to prevent already shipping InterfaceLib browsers and installers from finding and attempting to use carbonized plug-ins.

Back to top



Other differences

A plug-in can be a simple CFM library, but may also be built as a package, or as a packaged data-fork-only file. Packaged data-fork-only plug-ins are encouraged since they can be installed on non-HFS file systems. On traditional Mac OS, many browsers will look for plug-ins in a directory adjacent to the browser as well as in the System Folder's "Internet Plug-Ins" folder. On Mac OS X plug-ins should only be placed in the /Library/ Internet Plug-Ins directory. The location of the directory can be determined programmatically with FindFolder, specifying kLocalDomain (-32765) for the vRefNum and kInternetPlugInFolderType ('ƒnet') for the folder type.

Back to top



References

See Apple Technical Note TN2003 for general information about Carbonizing your code, http://developer.apple.com/technotes/tn/tn2003.html. For more information about how to write a browser plug-in for traditional Mac browser plug-in information, see Netscape's plug-in documentation at the address http://developer.netscape.com/docs/manuals/communicator/plugin/index.htm.

Back to top



Downloadables

Acrobat gif

Acrobat version of this Note (44K)

Download

Back to top




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.