6

My app uses WebKit to display previews of web, and I want to suppress plugins such as the Acrobat one from loading, mainly because of the unreliability it can cause, but also for UI reasons.

I know I can use [WebPreferences setPlugInsEnabled:] to disable plugins, but I really want to do it on a case-by-case basis, i.e. Acrobat Disabled, Flash enabled, etc...

Is this possible?

Cheers!

MT

MT.
  • 227
  • 1
  • 12

1 Answers1

0

I don't believe you have direct hooks to the plugins (particularly Netscape-style plugins), but there's another solution that is probably more appropriate and will save your user's download bandwidth. Implement WebPolicyDelegate's webView:decidePolicyForMIMEType:request:frame:decisionListener:. If it is a distasteful MIME type, send -ignore to the listener.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • This sounds worth a go, thanks! The main reason I want to do this is that my users have reported crashes involving the Acrobat plugin, so I'd rather not load it at all. – MT. Feb 07 '10 at 13:57
  • Unfortunately, this does not work. The plug-in loading mechanism intercepts the MIME type before it ever gets to the policy delegate. You might want to look at my answer to [this question.](http://stackoverflow.com/questions/4885513/prevent-flash-in-cocoa-webview/4886150#4886150) – Rob Keniger Feb 03 '11 at 12:35