在WebKit中禁止插件加载 [英] Suppress plugin loading in WebKit
问题描述
我的应用程序使用WebKit显示Web的预览,我想禁止插件,如Acrobat的加载,主要是因为它可能导致的不可靠性,但也是因为UI的原因。
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.
我知道我可以使用[WebPreferences setPlugInsEnabled:]来禁用插件,但我真的想在个案的基础上,即Acrobat禁用,启用闪光灯等。
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...
这是否有可能?
干杯!
推荐答案
我不相信你有直接钩子插件(特别是Netscape风格的插件),但还有另一个解决方案可能更适当,并将保存您的用户的下载带宽。实现WebPolicyDelegate的 webView:decisionsPolicyForMIMEType:request:frame:decisionListener:
。如果它是一个令人讨厌的MIME类型,发送 -ignore
到侦听器。
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.
这篇关于在WebKit中禁止插件加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!