tags:

views:

44

answers:

2

I'm developing an application (download manager-type) on OS X that I would like to integrate with the major Mac browers (Safari, Firefox, Chrome, Opera, Camino) via the Mozilla plug-in API, NPAPI. I have a basic understanding of how to register my app on the Mac to handle specific URL's and file types (via the Launch Services API, the info.plist file, etc.), and I also understand that I can register for specific MIME types in the NPAPI. However, I see almost no hooks in the NPAPI docs for integration with external applications, i.e. getting a URL via NPN_GetURL() when a hyperlink is clicked and passing this data on to an external application. The only references I've found to calling external applications is the system function in C, and I'm finding it hard to believe this is the only way it can be done. I know that other Mac apps (download managers) are able to integrate with browsers in this fashion, but there seems to be very little documentation about it. Am I misunderstanding the purpose of the NPAPI?

A: 

Yes, you are misunderstanding NPAPIs purpose. For things like intercepting clicking of links and changing the browsers behavior you need to write browser extensions, not a plugin.

See:

Georg Fritzsche
A: 

The actual API of NPAPI is very limited; much of what plugins do they do through direct system calls. system isn't your only option—you can use anything you would use any any OS X application (NSWorkspace, Apple Events, IPC to a launchd-registered service, etc.)—but you won't find a call in NPAPI to do what you want.

smorgan