https://developer.chrome.com/docs/extensions/
https://developer.chrome.com/docs/extensions/mv3/architecture-overview/
今天学习了一下chromeextension开发,开发了一个插件,主要用来自动approve gitlab代码,发送消息并默默关闭tab
manifestv2
关键概念:
manifest.json
browserAction (针对所有页面的)
pageAction (针对特定页面的)
区别:
https://stackoverflow.com/questions/44712495/what-are-the-differences-between-page-action-and-browser-action/44713058
https://developer.chrome.com/docs/extensions/reference/browserAction/
https://developer.chrome.com/docs/extensions/reference/pageAction/
contentScript(能和当前某个tab内容进行交互)
触发时机:https://stackoverflow.com/questions/43233115/chrome-content-scripts-arent-working-domcontentloaded-listener-does-not-execut
background
background分为 background pages和event pages
区别:
https://chrome-apps-doc2.appspot.com/extensions/event_pages.html
https://chrome-apps-doc2.appspot.com/extensions/background_pages.html
https://developer.chrome.com/docs/extensions/mv2/background_pages/
devtools
https://developer.chrome.com/docs/extensions/mv3/devtools/
manifestv3
https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/
v3比较新,但是自己实际写的时候有时候有些问题,比如chrome.notification调不了,目前还是比较新鲜
debugging:
bgscript: