tags:

views:

208

answers:

2

Hi guys!

I want to develop Safari plugin using xCode, What API should I use? Someone can give me some documents or sample codes ,Thanks very much!

+1  A: 

Check out Rentzsch's ClickToFlash, it's a plug-in that is fairly well documented, along with neat source code.

jbrennan
+3  A: 

The answer is rather complicated i'm afraid.

Unfortunately, Safari the web browser does not have a plugin API. That means you technically cannot extend Safari's user interface or features using plugins.

However, WebKit the web rendering engine (which powers Safari and many other browsers/apps) does have a plugin API (actually it has 2) which allows you to create plugins for rendering web content inside webkit webviews.

You can find documentation on developing WebKit plugins in Apple's docs here:

http://tod.nu/wkplugin

Also note: Safari's lack of a true plugin API has not stopped lots of developers from developing various pieces of software which they call "Safari plugins" even tho they are technically not Safari plugins. They are usually something called an "Input Manager" which are widely viewed as rather questionable pieces of software. Input Managers always seem to be on the cusp of becoming unsupported or broken by Apple. It's not really clear whether Input Managers are kosher with Apple or not.

Then again, several "Safari plugin" Input Managers are quite popular, so....

Input Managers are a whole other topic. I'm sure if you google it you can find a lot of information on them. However, personally I would advise against developing an Input Manager due to their questionable status in the Mac software world and their constant danger of becoming unsupported or badly broken.

Todd Ditchendorf
Also doomedness. Input Manager bundles don't work in 64-bit, which means they don't work in most apps (including Safari) in Snow Leopard.
Peter Hosey
Input Managers were never "supported" for arbitrary code execution. They were intended to let developers provide alternate methods for text entry, ala the Chinese character palette. There are now other ways to add input methods (see InputMethodKit), and Input Managers are toast.
Ken