问题描述
我知道可以手动禁用Chromium中的Flash插件:
只需到chrome:// plugins /,找到Adobe Flash Player和禁用它。
我想知道是否有可能使用JavaScript代码或任何客户端禁用Flash从扩展脚本语言?还有,有没有办法与FlashBlock等其他扩展进行通信,来动态更新黑白名单?解析方案
我知道可以手动禁用Chromium中的Flash插件:
只需到chrome:// plugins /,找到Adobe Flash Player和禁用它。
我想知道是否有可能使用JavaScript代码或任何客户端禁用Flash从扩展脚本语言?还有,有没有办法与FlashBlock等其他扩展进行通信,来动态更新黑白名单?解析方案
答案是的,只要你想阻止flash插件加载,而不是真的全局禁用它。
相应的API是
manifest.json:
permissions:[contentSettings]
您的脚本:
$ $ p $ (
primaryPattern:'< all_urls>',
resourceIdentifier:{
id:'adobe-flash-玩家'
},
设置:block?'block':'allow'
});
}
I know that it is possible to disable the Flash plugin in Chromium manually:
just go to chrome://plugins/, find "Adobe Flash Player" and disable it.
I was wondering if it is possible to disable Flash using JavaScript code or any client side Scripting language from an extension? And also, is there a way to communicate with other extensions such as FlashBlock, to dynamically update black/whitelists?
The answer is kind-of-yes, as long as you want to prevent flash plugin from loading, and not really disabling it globally.
The corresponding API is chrome.contentSettings
manifest.json:
"permissions": [ "contentSettings"]
Your script:
function blockFlash(block) {
chrome.contentSettings.plugins.set({
primaryPattern: '<all_urls>',
resourceIdentifier: {
id: 'adobe-flash-player'
},
setting: block ? 'block' : 'allow'
});
}
这篇关于是否可以从Chromium扩展中禁用Flash插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!