是否可以从Chromium扩展中禁用Flash插件? [英] Is it possible to disable the Flash plugin from a Chromium extension?

查看:424
本文介绍了是否可以从Chromium扩展中禁用Flash插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以手动禁用Chromium中的Flash插件:



只需到chrome:// plugins /,找到Adobe Flash Player和禁用它。



我想知道是否有可能使用JavaScript代码或任何客户端禁用Flash从扩展脚本语言?还有,有没有办法与FlashBlock等其他扩展进行通信,来动态更新黑白名单?解析方案

答案是的,只要你想阻止flash插件加载,而不是真的全局禁用它。



相应的API是 chrome.contentSettings



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插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆