views:

261

answers:

1

The issue is that I've written a Safari plug-in (http://tr.im/growler) that allows web applications to send Growl notifications by calling Javascript functions. However, at the moment the way it is written, people need to use <embed> to initialise the plug-in so that Javascript can begin using it (something I picked up from Apple's examples).

I was wondering if there was a way I could define something like window.<pluginName> so that they didn't have to embed it everytime? That'll allow a lot of sites to begin using it without changing any code.

I've looked at a lot of examples and documentation, and two things came up — 'WebView' and 'WebScriptObject'. I'm pretty new to this, so I'm not really sure what to do.

+2  A: 

There's no way to write a WebKit plug-in that doesn't handle a content type. That's why so many Safari “plug-ins” or “extensions” (including GrowlSafari) are implemented as input manager hacks.

The way you've done it is the only reliable, safe, supported, and not doomed way to do it.

Peter Hosey
Really? That's bad, because that also means there's no real way to check if my plug-in exists (which makes it harder to gracefully degrade). Any mighty brain waves in this regard?
aditya
Never mind, figured it out. Unlike Firefox, WebKit implements the `navigator.plugins` rather nicely.
aditya