开始

manifest.json

  1. {
  2. "manifest_version": 2,
  3. "name": "kyleThanas扩展",
  4. "version": "1.0.0",
  5. "description": "kyleThanas、快捷入口",
  6. "author": "kyleThanas",
  7. "icons": {
  8. "48": "img/kt48.png",
  9. "128": "img/kt128.png"
  10. },
  11. "background": {
  12. "scripts": ["background.js"]
  13. },
  14. "browser_action": {
  15. "default_icon": "img/kt48.png",
  16. "default_title": "这是一个示例Chrome插件",
  17. "default_popup": "popup.html"
  18. },
  19. "content_scripts": [
  20. {
  21. "matches": ["https://www.baidu.com/*"],
  22. "js": ["jquery-1.8.3.js", "content-script-baidu.js"]
  23. },
  24. {
  25. "matches": ["https://www.jianshu.com/p/*"],
  26. "js": ["jquery-1.8.3.js", "content-script-jianshu.js"]
  27. }
  28. ],
  29. "permissions": [
  30. "contextMenus",
  31. "tabs",
  32. "notifications",
  33. "webRequest",
  34. "webRequestBlocking",
  35. "storage",
  36. "downloads",
  37. "declarativeContent"
  38. ],
  39. "homepage_url": "http://114.67.228.124/"
  40. }

popup.html弹出页—弹出展示的小妖精
background.js背景页—默默支持

参考

  1. Chrome扩展程序开发
  2. chrome extensions JavaScript API