Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here and here.(注意:本文中的建议仅适用于JxBrowser6。请在此处和此处参阅有关JxBrowser 7的相应文章。)
To get information about all installed and available plugins you can use the
PluginManager.getPluginsInfo()
method:
(要获取有关所有已安装和可用插件的信息,可以使用PluginManager.getPluginsInfo()方法)
PluginManager pluginManager = browser.getPluginManager(); List<PluginInfo> pluginsList = pluginManager.getPluginsInfo(); for (PluginInfo plugin : pluginsList) { System.out.println("Plugin Name: " + plugin.getName()); }
To enable/disable specified plugin register your own PluginFilter implementation:(要启用/禁用指定的插件,请注册您自己的PluginFilter实现:)
pluginManager.setPluginFilter(new PluginFilter() { @Override public boolean isPluginAllowed(PluginInfo pluginInfo) { // Allow only PDF plugin return pluginInfo.getMimeTypes().contains("application/pdf"); } });