Chrome插件群里一位大佬说过。。。chrome插件跟exe没区别。
好的,既然介绍了插件的强大,那么如何编写插件呢?
https://chajian.baidu.com/developer/extensions/getstarted.html
大家就别去看chrome原版了,来看这个百度浏览器的翻译版。
插件主要是通过两个js来进行操作。
一个是   "background": {
     "scripts": [
      "tools.js"
    ]
   },
一个是   "content_scripts": [
    {
        "matches": [":///*"],
        "js": ["script.js"]
    }
   ],
content_scripts里的js可以直接植入加载的dom中,如:document.getElementsByTagName
background里的js可以后台操作chrome的接口,如:
chrome.webRequest.onBeforeRequest.addListener(
  function(details) { return {cancel: true}; },
  {urls: ["*://drmcmm.baidu.com/*","*://cpro.baidu.com/*","*://hm.baidu.com/*","*://pos.baidu.com/*"]},
  ["blocking"])    //这段的意思是onBeforeRequest的时候,干掉百毒推广!!!
注:接口参考文档https://chajian.baidu.com/developer/extensions/webRequest.html
就酱紫。。欢迎大家写出更多更好的chrome插件。本文就水到此处了。